0
Why do i need to type no twice to get my end printout for my dice roll game?
from random import * print("Welcome! Type yes or no to roll the dice!") while input() == "yes": print("Dice roll is: ", randint(1, 6)) print("Would you like to roll again?") if input() == "no": print("Thanks for playing!")
1 Réponse
+ 4
You code asks for an input in the while loop, but it doesn't assign it to any variable, so the value is "lost". Then, it asks for another independent input in the if condition.