Python List Comprehension Review

Quiz
•
Computers
•
9th - 12th Grade
•
Medium
Cedra Wilson
Used 131+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will the following list comprehension output?
squares = [x**2 for x in range(5)]
print(squares)
[0, 1, 4, 9, 16]
[1, 4, 9, 16, 25]
[0, 2, 4, 6, 8]
[1, 3, 5, 7, 9]
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following list comprehension?
vowels = ['a', 'e', 'i', 'o', 'u']
vowels2 = [vowel.upper() for vowel in vowels]
print(vowels2)
['a', 'e', 'i', 'o', 'u']
['A', 'E', 'I', 'O', 'U']
['a', 'E', 'i', 'O', 'u']
['A', 'e', 'I', 'o', 'U']
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following list comprehension?
list1 = ['H', 'E', 'L', 'L', 'O']
list2 = [list1.lower() for letters in list1]
print(list2)
['H', 'E', 'L', 'L', 'O']
['h', 'e', 'l', 'l', 'o']
['h', 'E', 'l', 'L', 'o']
['H', 'e', 'l', 'L', 'o']
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is the output of the following code?
list1=[1,2,3,4,5]
list2 = [i + 5 for i in list1]
print(list2)
[1, 2, 3, 4, 5]
[6, 7, 8, 9, 10]
[1, 2, 3, 4, 0]
[0,0,0,0,1]
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will the following list comprehension output?
list = [x * x for i in range(3)]
print(list)
[0, 1, 2]
[0, 1, 4]
[0, 1, 4, 9]
It throws an error
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will the following list comprehension output?
list = [i * 10 for i in range(5)]
print(list)
[0, 10, 20, 30, 40]
[0, 5, 10, 15, 20]
[0, 1, 2, 3, 4]
[10, 10, 10, 10, 10]
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will the following list comprehension output?
l = [i * 2 for i in range(1, 6)]
print(l)
[0, 2, 4, 6, 8, 10]
[2, 4, 6, 8, 10]
[1, 2, 3, 4, 5]
Create a free account and access millions of resources
Similar Resources on Wayground
10 questions
Python списки

Quiz
•
10th Grade
10 questions
KS4 Programming Techniques (1)

Quiz
•
8th - 10th Grade
15 questions
PCEP Section 3B: list methods: append(), insert(), index()

Quiz
•
12th Grade
12 questions
Матрицы и генераторы списков

Quiz
•
10th Grade
15 questions
Жанар214

Quiz
•
9th Grade - University
15 questions
Exploring Python Data Structures Quiz

Quiz
•
10th Grade
10 questions
QUIZ PYTHON KELAS X PSTS

Quiz
•
10th Grade
13 questions
Programming Quiz

Quiz
•
10th Grade
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Computers
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
10 questions
1.2 OSI & TCP IP Models Quiz

Quiz
•
10th Grade
20 questions
Digital Citizenship

Quiz
•
8th - 12th Grade
30 questions
Introduction to Computers

Quiz
•
8th - 9th Grade
35 questions
Computer Baseline Examination 2025-26

Quiz
•
9th - 12th Grade
13 questions
Problem Solving Process

Quiz
•
9th - 12th Grade
20 questions
Hardware vs. Software Quiz

Quiz
•
7th - 10th Grade
10 questions
Understanding Algorithms with Pseudocode and Flowcharts

Interactive video
•
9th - 12th Grade