O'Reilly logo

Python Projects for Kids by Jessica Ingrassellino

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required