I can't exit the program when the condition at start of the code is met and it also prevents the rest of the code from working when it is not met. However if you remove the conditions from the start the code works fine. How do I get the conditions at the start to work properly? P.S I know the code can be condensed.
import sys
user1 = (input("User 1 type your name " )).lower
user2 = (input("User 2 type your name ")).lower
if user1 != "bob":
sys.exit()
if user2 != "fred":
sys.exit()
from random import randint
total = 1
score1 = 0
score2 = 0
while total <6:
roll = (input("User 1 x press 1 to roll the dice "))
if roll == "x":
dice = randint(1,6)
print("You got",dice)
score1 = score1+dice
print("User 1 your score is",score1)
roll2 = (input("\nUser 2 press x to roll the dice "))
if roll2 == "x":
dice = randint(1,6)
print("You got",dice)
score2 = score2+dice
print("User 2 your score is",score2)
total = total+1
if total == 6:
print("\nUser1 your total score is",score1)
print("User2 your total score is",score2)
while total >= 6:
if score1 == score2:
print("It's a tie! Whoever rolls the highest number wins")
roll = (input("User 1 press x to roll the dice"))
if roll == "x":
dice = randint(1,6)
print("You got",dice)
score1 = score1+dice
print("User 1 your score is",score1)
roll2 = (input("\nUser 2 press x to roll the dice"))
if roll2 == "x":
dice = randint(1,6)
print("You got",dice)
score2 = score2+dice
print("User 2 your score is",score2)
if score1 > score2:
print("\nUser 1 wins")
break
if score1 < score2:
print("\nUser 2 wins")
break