Loops & Comprehensions Quiz

Complete this assessment with 100% score to master this chapter.

01What does enumerate() do when used in a for loop?

02What does this list comprehension produce: [x**2 for x in range(1, 6)]?

03What is the difference between a list comprehension and a generator expression?

04What does zip() do when given two lists of different lengths?

05How do you write a dictionary comprehension that maps words to their lengths?