This program is very simple, so I won’t write too much about it. The only thing here that might be new is the “try:” section. This is a bit of error handling. If your user types in a number above 100 or below 0, the program can cope very well. But if the user types in something that is not a (whole) number, there would be an error if we didn’t use this approach. Basically, the program tries to convert “guess” to an integer. If this isn’t possible, the “ValueError” is trapped and the code tells the user that he/she didn’t enter a number.
Anyway, have a go. “Guess the Number” is a classic beginner’s program!