Try this def guess1(upLimit = 100): import random num = random.randint(1,upLimit) count = 0 gotIt = False while (not gotIt): print('Guess a number between 1 and', upLimit, ':') guess= int(input()) count += 1 if guess == num: print('Congrats! You win') gotIt = True elif guess < num: print('Go up!') else: print('Guess less') print('You got it in ', count, 'guesses.')
guess1(100) -- https://mail.python.org/mailman/listinfo/python-list