Practice Traversing a List (Looping Through a List) - 20.8 | 20. LIST – Python Data Structures | CBSE Class 9 AI (Artificial Intelligence)
K12 Students

Academics

AI-Powered learning for Grades 8–12, aligned with major Indian and international curricula.

Professionals

Professional Courses

Industry-relevant training in Business, Technology, and Design to help professionals and graduates upskill for real-world careers.

Games

Interactive Games

Fun, engaging games to boost memory, math fluency, typing speed, and English skills—perfect for learners of all ages.

Practice Questions

Test your understanding with targeted questions related to the topic.

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!

Practice 4 more questions and get performance evaluation

Interactive Quizzes

Engage in quick quizzes to reinforce what you've learned and check your comprehension.

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.

Solve and get performance evaluation

Challenge Problems

Push your limits with challenges.

Question 1

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.

Question 2

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.

Challenge and get performance evaluation