Wednesday, 21 August 2013

Python - random.randint () issue

Python - random.randint () issue

After randomly generating a number, I check to see if the user's input
matches. If it does, print one line, if not, print another. Even if the
user guesses correctly, the other line prints.
chosenNumber = input ("Choose a number: ")
int (chosenNumber)
diceRoll = random.randint (1,3)
print ("The number rolled is: ",diceRoll)
if diceRoll == chosenNumber:
print ("WINNER")
else:
print ("LOSER")
Thank you for any help.

No comments:

Post a Comment