Practice Traversing a List (Looping Through a List) - 20.8 | 20. LIST – Python Data Structures | 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

Traversing a List (Looping Through a List)

20.8 - Traversing a List (Looping Through a List)

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 be the output of the following code? fruits = ['apple', 'banana', 'mango']; for fruit in fruits: print(fruit)

💡 Hint: Think about what each element in the list is.

Question 2 Easy

How do you access the first element of the list using indexing?

💡 Hint: Remember, indexing starts from 0!

4 more questions available

Interactive Quizzes

Quick quizzes to reinforce your learning

Question 1

What is the output of the code fruits = ['apple', 'banana', 'mango']; for i in range(len(fruits)): print(fruits[i])?

apple
banana
mango
All of the above

💡 Hint: Think of what the loop is doing with each index.

Question 2

True or False: Using for fruit in fruits is the only way to traverse a list.

True
False

💡 Hint: Consider the different methods we've discussed.

Get performance evaluation

Challenge Problems

Push your limits with advanced challenges

Challenge 1 Hard

Write a function that takes a list of numbers and returns a new list with each number doubled using traversal.

💡 Hint: Consider how the items should be processed as you traverse the list.

Challenge 2 Hard

Given a 2D list, write a function that returns the sum of all the inner lists by traversing.

💡 Hint: You will need to traverse the outer list and then the inner lists.

Get performance evaluation

Reference links

Supplementary resources to enhance your learning experience.