Chapter 4. Norwegian Blue parrot game: adding logic to programs
In this chapter, you’ll learn how to create Python programs that
- Display an introduction
- Collect input from the user
- Use if statements to respond to users in different ways
- Use while loops to repeat things over and over
- Use Python code libraries to generate random numbers
Open a popular game, such as Minecraft, or think about a robot, like the Mars rover. Both are computer programs. What do they have in common? They both have the ability to take input and do something with it. What they do depends on the input they’re given. In a game, if you press Forward and fall off a ledge, your character falls and dies. If it’s your only life, then you’re taken to the Game Over screen. ...
Get Hello Raspberry Pi! 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.