21.1 - The IF 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 will the following code output?
💡 Hint: Check if age is 18 or older.
Write an IF statement that checks if the number is positive.
💡 Hint: Think about using the greater than operator.
4 more questions available
Interactive Quizzes
Quick quizzes to reinforce your learning
What does an IF statement do?
💡 Hint: Think about what makes the IF statement distinct.
True or False: The ELSE statement only executes if the IF condition is true.
💡 Hint: Reflect on what the purpose of ELSE is.
1 more question available
Challenge Problems
Push your limits with advanced challenges
Create a nested IF statement that checks whether a user can attend college based on both their age and their high school diploma status. Write the conditional structure.
💡 Hint: Consider how you can check two separate conditions effectively.
Write a program that continuously prompts for a user’s age until they provide a correct response (18 or older) and informs them of their eligibility to vote.
💡 Hint: Think about how to use a loop to keep asking.
Get performance evaluation
Reference links
Supplementary resources to enhance your learning experience.