I'm trying to create a small python program to emulate rolling a single die. My problem arises in that I want the program to accept both upper and lower-case 'Y' to trigger a re-roll. My program works when I accept either upper or lower case y but when I try to change the line
if usr == 'Y'
to
if usr == 'Y' or 'y'
creates a problem where it never enters the else statement, making the program never terminate.
import randomdef DiceRoll():number = random.randrange(1, 7, 1)print("Dice Roll: ", number)AskUser()returndef AskUser():usr = input("Roll Again? (Y/N) \n")if usr == 'Y':DiceRoll()else :print("Thank you for playing!")
returnDiceRoll()