I'm new to python so any constructive criticism will be welcome. But when I type letters into the input it comes up with and error, but if I leave the input as input I get the error
unorderable types: str() >= int().
Is there any ways around this?
My code:
print("Please guess a number between 1 and 50")
import random
randomNumber = random.randint(1,50)
def main():
banana = False
while not banana:
userGuess = int(input("Your guess: "))
print("Your guess was: {}".format(userGuess))
if userGuess == randomNumber:
print("Congrats!")
banana = True
elif userGuess >= 51:
print("Please guess a number between 1 and 50")
elif userGuess < randomNumber:
print("Go higher!")
elif userGuess > randomNumber:
print("Go lower!")
if __name__ == "__main__":
main()
print("Thank you for playing!")