Practice Try It Yourself - 4.7 | Control Flow – if, elif, else | Python Programming Language
Students

Academic Programs

AI-powered learning for grades 8-12, aligned with major curricula

Professional

Professional Courses

Industry-relevant training in Business, Technology, and Design

Games

Interactive Games

Fun games to boost memory, math, typing, and English skills

Try It Yourself

4.7 - Try It Yourself

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.

Learning

Practice Questions

Test your understanding with targeted questions

Question 1 Easy

Write a simple Python program to check if a number is positive or negative.

💡 Hint: Think about what conditions need to be checked.

Question 2 Easy

Create a program that prints whether a user input is even or odd.

💡 Hint: Use if to check if the number % 2 equals 0.

4 more questions available

Interactive Quizzes

Quick quizzes to reinforce your learning

Question 1

What statement is used to check conditions in Python?

if
loop
function

💡 Hint: Think about what structures control program flow.

Question 2

True or False: The else statement executes when the if condition is True.

True
False

💡 Hint: Recall what happens when conditions aren't met.

3 more questions available

Challenge Problems

Push your limits with advanced challenges

Challenge 1 Hard

Design a program that outputs whether a number is a prime number or not, including error handling for invalid inputs.

💡 Hint: Remember to validate the number before checking if it's prime.

Challenge 2 Hard

Create a voting eligibility program that includes state-specific rules, checking not just age and ID but residency.

💡 Hint: Nested conditions will help refine eligibility based on multiple factors.

Get performance evaluation

Reference links

Supplementary resources to enhance your learning experience.