When I am trying to substract a random number generated using randint function from a number entered by user, I am receiving below error.
Hope someone call help me.
Traceback (most recent call last): File "C:\Users\vishal.mohan.gada\Documents\GIt\PythonLearning\Class\exercise9.py", line 5, in if(rannum-input==0): TypeError: unsupported operand type(s) for -: 'int' and 'function'
My Code:
import random
rannum=random.randint(1,9)
print(rannum)
inputUser=int(input("Please guess one number between 1 to 10: "))
if(rannum-input==0):
print("Your Guess was right! Congratulations")
elif(rannum-input<0):
print("Your guess was high")
else:
print("Your guess was low")
Aucun commentaire:
Enregistrer un commentaire