
Computer Programming - Python Looping and List
Authored by Maharsa Pradityatama
Computers
Used 2+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Write a for loop that prints numbers from 1 to 5.
for (i = 1; i <= 6; i++)
for (i = 1; i <= 5; i++)
for (i = 1; i < 5; i++)
for (i = 5; i >= 1; i--)
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Use list comprehension to create a list of squares of numbers from 1 to 5.
[1, 4, 9, 16, 36]
[1, 4, 9, 16, 49]
[1, 4, 9, 16, 64]
[1, 4, 9, 16, 25]
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Implement a while loop to find the largest number in a list.
{ "numbers": [7, 7, 7, 7, 7], "largest": 7 }
{ "numbers": [1, 2, 3, 4, 5], "largest": 1 }
{ "numbers": [8, 6, 4, 2, 0], "largest": 0 }
{ "numbers": [5, 3, 9, 1, 7], "largest": 9 }
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Use list comprehension to create a list of even numbers from 1 to 10.
[2, 4, 6, 8]
[1, 3, 5, 7, 9]
[2, 4, 6, 8, 10]
[2, 4, 6, 8, 10, 12]
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Use list comprehension to create a list of odd numbers from 1 to 10.
[1, 3, 5, 7, 9]
[2, 4, 6, 8, 10]
[1, 2, 3, 4, 5]
[1, 3, 5, 7, 9, 11]
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Write a for loop that prints numbers from 5 to 1.
for (i = 5; i >= 1; i--)
for (i = 1; i <= 5; i++)
for (i = 1; i < 5; i++)
for (i = 5; i > 1; i--)
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Implement a while loop to calculate the sum of numbers in a list.
{ "numbers": [1, 2, 3, 4, 5], "sum": 15 }
{ "numbers": [5, 5, 5, 5, 5], "sum": 25 }
{ "numbers": [10, 20, 30, 40, 50], "sum": 150 }
{ "numbers": [2, 4, 6, 8, 10], "sum": 30 }
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?