#!/usr/bin/env python # coding: utf-8 # In[1]: import random true_value = random.randint(0, 100) while True: guess = input('Enter your guess: ') try: guess = int(guess) if guess == true_value: print('Congratulations! You guessed correctly.') break elif guess > true_value: print('Lower.') # user guessed too high else: print('Higher.') # user guessed too low # when the input is invalid except ValueError: print('Please enter a valid number.') # In[ ]: