21.1.3 - IF-ELSE Statement
Enroll to start learning
You’ve not yet enrolled in this course. Please enroll for free to listen to audio lessons, classroom podcasts and take practice test.
Practice Questions
Test your understanding with targeted questions
What is the purpose of an IF statement?
💡 Hint: Think about how we decide what to do based on questions.
Write a simple IF statement to check if a number is positive.
💡 Hint: Make sure you are checking the number correctly!
4 more questions available
Interactive Quizzes
Quick quizzes to reinforce your learning
What will be printed if age = 15 in the following code?
if age >= 18:
print('Eligible to vote')
else:
print('Not eligible to vote')
💡 Hint: Remember what the if condition checks for.
In Python, can you have multiple IF statements without chaining them with ELIF?
💡 Hint: Think about how we can check things independently.
1 more question available
Challenge Problems
Push your limits with advanced challenges
Write a program that uses nested IF-ELIF-ELSE statements to evaluate a player's score in a game and categorize them as Beginner, Intermediate, Expert, or Pro based on different ranges.
💡 Hint: Think about the ranges you want to define for each category.
A theatre group uses conditional statements to decide ticket prices. Write an IF-ELIF-ELSE statement that handles discounts for children, adults, and seniors.
💡 Hint: Consider how age impacts ticket pricing and what categories you will use.
Get performance evaluation
Reference links
Supplementary resources to enhance your learning experience.