Jan-05-2019, 02:19 PM
The input() function always returns a string. Because strings are not numbers, they cannot be compared. To fix this, you need to cast the input to a number type:
from random import randint def diceRollingSimulator(): dice = randint(1, 6) print(dice) diceRollingSimulator() answer = int(input("Would you like to play again? (enter 1 for yes or 2 for no): ")) if answer == 1: diceRollingSimulator() elif answer == 2: print("Thanks for playing!") else: print("Not a valid input!")