Chapter 5. Loops and Logic

In the previous chapter, you learned how to use logic, such as if, elif, and else, to help design programs that could respond to user input in many ways. Also, you learned how to use the while and for loops. In this chapter, we will build our first mini game, called Higher or Lower. The game is a number guessing game, and we will use it to combine logic and loops to make a game that responds to many user requests.

Tip

Remember to save your work frequently so that you can make corrections to your code!

Higher or Lower

Higher or Lower is a numbers guessing game. In this game, the computer chooses a random number, and the user tries to guess what number the computer has chosen. There are many different ways to build this game, ...

Get Python Projects for Kids now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.