Practice IF-ELSE Statement - 21.1.3 | 21. IF, FOR, WHILE | CBSE 9 AI (Artificial Intelligence)
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

IF-ELSE Statement

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.

Learning

Practice Questions

Test your understanding with targeted questions

Question 1 Easy

What is the purpose of an IF statement?

💡 Hint: Think about how we decide what to do based on questions.

Question 2 Easy

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

Question 1

What will be printed if age = 15 in the following code?
if age >= 18:
print('Eligible to vote')
else:
print('Not eligible to vote')

Eligible to vote
Not eligible to vote

💡 Hint: Remember what the if condition checks for.

Question 2

In Python, can you have multiple IF statements without chaining them with ELIF?

True
False

💡 Hint: Think about how we can check things independently.

1 more question available

Challenge Problems

Push your limits with advanced challenges

Challenge 1 Hard

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.

Challenge 2 Hard

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.