8.6 - 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.
Practice Questions
Test your understanding with targeted questions
Write a for loop to print each number in the list [1, 2, 3].
💡 Hint: Remember, you need to iterate through the list.
What does len(fruits) return if fruits is ['apple', 'banana', 'cherry']?
💡 Hint: Think about how many fruits are in the list.
4 more questions available
Interactive Quizzes
Quick quizzes to reinforce your learning
What does a for loop do?
💡 Hint: Think about when you want to perform an action for each item.
True or False: A while loop must have a condition that evaluates to false to stop executing.
💡 Hint: Imagine it like a door that stays open while the light is on.
Get performance evaluation
Challenge Problems
Push your limits with advanced challenges
Create a program that uses a while loop to ask for input until the user types 'quit', printing each input back.
💡 Hint: Think about how to prompt for input continually.
Write a function that accepts a list of integers and returns a new list containing only the even numbers, using a for loop.
💡 Hint: Remember to check each number's remainder when divided by 2.
Get performance evaluation
Reference links
Supplementary resources to enhance your learning experience.