I'm learning python and i'm making a 2 player dice-rolling game but i can't seem to allow the players to roll or play another round. This is the code that i've written. Id appreciate it if someone could help me correct the codes. Thankss!
import random
import time
player_a = input("Player1, please type your name:")
time.sleep(1)
player_b = input("Player2, please type your name:")
time.sleep(1)
print("Welcome to Dice Roller", player_a, "and", player_b)
score_a = 0
score_b = 0
roll_a = False
roll_b = False
while not (roll_a and roll_b):
ans_a = input("Type roll to roll the dice:")
if ans_a == "roll":
roll_a = (random.randint(1, 6))
time.sleep(1)
print(player_a, "has rolled", roll_a)
else:
print("Please check you spelling")
time.sleep(2)
ans_b = input("Your turn to roll, type roll to roll the dice:")
if ans_b == "roll":
roll_b = (random.randint(1, 6))
time.sleep(1)
print(player_b, "has rolled", roll_b)
if roll_a == roll_b:
time.sleep(2)
print("Tie")
break
roll_a = False
roll_b = False
if roll_a > roll_b:
score_a = roll_a - roll_b
print(player_a, "has scored", score_a, "points")
break
roll_a = False
roll_b = False
if roll_b > roll_a:
score_b = roll_b - roll_a
print(player_b, "has scored", score_b, "points")
break
roll_a = False
roll_b = False