I was trying to create a guessing game in Python, and it keeps on printing out the else: part even if I typed in the right number (1). What did I do wrong?
print("Pick a number from one to 10 ")
guess = input("Type a number")
num = 1
if guess == 1:
print("GoodJob actual wizard.")
else:
print("Try again")
You never specify what type guess is, you need to convert it to an int otherwise comparing it to any integer will be False.
Replace:
guess = input("Type a number")
With:
guess = int(input("Type a number"))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With