Using Python to Write Guessing Games

1. Guess the number game. Set an integer between 0 and 20, let the user guess and input the guessed number. If it is greater than the preset number, it will display "too large"; Less than the preset number, display "too small",
#If the input is not an integer, a prompt is given to enter numbers from 0 to 20, and this loop continues. If it is an integer less than 0 or greater than 20, a prompt is given to only enter numbers from 0 to 20 until the number is guessed correctly, displaying "Congratulations! You guessed it!"

Code implementation process:

This foundation is not difficult, the focus is on the use of try. except exception statements, which are the operations to be performed when the input number is not an integer.