"""This is my code"""
Can someone tell me precisely where and what the mistake is AND why it is a mistake?
Thanks.
def main():
print ("Guess a number between 1 and 100.")
randomNumber = 35
found = False # flag variable to see
# if they've guessed it
while not found:
userGuess = input("Your guess: ")
if userGuess == randomNumber:
print ("You got it!")
found = True
elif userGuess > randomNumber:
print ("Guess lower!")
else:
print ("Guess higher!")
main()""" and this was the error message"""Error:Traceback (most recent call last):
File "/Users/Matthew/Documents/new.py", line 19, in <module>
main()
File "/Users/Matthew/Documents/new.py", line 14, in main
elif userGuess > randomNumber:
TypeError: '>' not supported between instances of 'str' and 'int'
>>> I think I am following the video exactly. Can someone tell me precisely where and what the mistake is AND why it is a mistake?
Thanks.
Moderator:
As buran pointed out, please use code tags.
I added them for you...this time.
sparkz_alot
