Practice The FOR Loop - 21.2 | 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

The FOR Loop

21.2 - The FOR Loop

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 will the following code output? for i in range(0, 3): print(i)

💡 Hint: Count from the start value up to but not including the stop value.

Question 2 Easy

Write a FOR loop to print 'Hello' 5 times.

💡 Hint: How many times do you want to print the message?

4 more questions available

Interactive Quizzes

Quick quizzes to reinforce your learning

Question 1

What does the range function in a FOR loop do?

It determines how many times to loop.
It creates a list of strings.
It only allows for even numbers.

💡 Hint: Think about what aspect of iteration the range function influences.

Question 2

True or False: A FOR loop can be used to iterate through a list.

True
False

💡 Hint: Consider the flexibility of FOR loops.

2 more questions available

Challenge Problems

Push your limits with advanced challenges

Challenge 1 Hard

Write a FOR loop that prints numbers from 20 to 0, decrementing by 2 each time.

💡 Hint: Remember how the step value adjusts the direction and increment.

Challenge 2 Hard

Consider a scenario where you have a list of student scores. Write a FOR loop to print a message for each score, indicating if it is a pass (>= 50) or a fail (< 50).

💡 Hint: You're checking a condition for each score; think about how if-else statements work.

Get performance evaluation

Reference links

Supplementary resources to enhance your learning experience.