concept else in category raspberry pi

This is an excerpt from Manning's book Hello Raspberry Pi!: Python programming for kids and other beginners.
If the guess is wrong (guess == parrot_age is False), then Python will do the else part. The statements to be executed for the else part are indented four spaces. In this case, if the guess is wrong, the program displays this on the screen:
Making code for multiple choices using if, elif, and else statements
The elif statement is short for else if. It checks whether another condition is True. Think of it like a multiple-choice question. If the user doesn’t enter L or Left, the program moves on to the next option. If the user doesn’t enter R or r, the program moves to the else statement and drops a stalactite on their head. Game over! Take a closer look at the if/elif/else statement in figure 5.5 to see how to make one.
Figure 5.5. The if statement can come in many flavors. This is an if statement with two elifs and an else. It creates logic in the code that can do many different things depending on the user’s input. In this case, you’re having a player guess the age of a parrot. The program will tell them if their guess is too low, too high, correct, or invalid.
![]()