The program asks for a user to set the max number of the range. That number is used to set the max range of a randomly generated number. The program keeps track of the number of guesses. I have taken a couple classes recently on different programming languages. I wrote a Hi/Low program in C a while back and decided to convert it to Python 3. I would appreciate someone looking at the code of the program and give me feedback on what I did good/bad and ways that I could improve.
def tooHigh(): guess = int(print("Your guess is too high, please try again: ")) return guess def tooLow(): guess = int(print("Your guess is too low, please try again: ")) return guess def guessLoop(x): guess=x counter+=1 if guess>gennum: guess = tooHigh() elif guess<gennum: guess = tooLow() elif guess==gennum: print("you guessed it!") return guess import random range=int(input("Please enter the maximum number of the range you would like to guess within: ")) gennum = random.randrange(range+1) guess = int(input("Please enter a number within the range: ")) counter =1 if guess==gennum: print("Congrats, you guessed right on the first try!") while not guess==gennum: loop(guess) print("It took you",counter,"guesses to guess correctly.")