
Python For Loop Exercises
Quiz
•
Computers
•
12th Grade
•
Hard
Akirapeter Yong
Used 3+ times
FREE Resource
Enhance your content in a minute
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code? 以下代码的输出是什么?
0 1 2
1 2 3
0 1 2 3
1 2
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is the correct way to iterate over a list in Python?
以下哪种是Python中遍历列表的正确方式?
`for i in list:`
`for i in range(list):`
`for i = 0; i < len(list); i++:`
`for i in len(list):`
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the `range(1, 5)` function generate?
range(1, 5) 函数会生成什么?
[1, 2, 3, 4, 5]
[1, 2, 3, 4]
[0, 1, 2, 3, 4]
[0, 1, 2, 3, 4, 5]
4.
DRAG AND DROP QUESTION
30 sec • 1 pt
Complete the code to print numbers from 0 to 4:
以下哪个关键字用于跳过当前循环迭代并进入下一次迭代?
for i in range( (a) ):
print(i)
3
4
6
5.
DROPDOWN QUESTION
30 sec • 1 pt
Fill in the blank to print each element of the list:
补全代码以打印列表中的每个元素:
for fruit in (a) :
fruit
range(fruits)
len(fruits)
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code?
以下代码的输出是什么?
2 4
2 4 6
2 3 4 5
2 3 4 5 6
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which keyword is used to skip the current iteration of a loop and move to the next iteration?
以下哪个关键字用于跳过当前循环迭代并进入下一次迭代?
break
continue
pass
skip
Create a free account and access millions of resources
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
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?
Similar Resources on Wayground
10 questions
cybercrime
Quiz
•
12th Grade - University
14 questions
Input, output and storage de
Quiz
•
8th Grade - Professio...
12 questions
Server Samba
Quiz
•
8th - 12th Grade
10 questions
Quiz sobre Contos
Quiz
•
12th Grade
15 questions
SOAL KOMPUTER KELAS 8 SEMESTER GANJIL
Quiz
•
7th - 12th Grade
10 questions
Cos’è la ROM?
Quiz
•
6th - 12th Grade
10 questions
Conosci Eoc-Desk?
Quiz
•
1st - 12th Grade
10 questions
JSPS Competition Hackathon - Scratch Language - Grade 1
Quiz
•
2nd Grade - University
Popular Resources on Wayground
10 questions
Ice Breaker Trivia: Food from Around the World
Quiz
•
3rd - 12th Grade
20 questions
Halloween Trivia
Quiz
•
6th - 8th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
4 questions
Activity set 10/24
Lesson
•
6th - 8th Grade
22 questions
Adding Integers
Quiz
•
6th Grade
10 questions
How to Email your Teacher
Quiz
•
Professional Development
15 questions
Order of Operations
Quiz
•
5th Grade
30 questions
October: Math Fluency: Multiply and Divide
Quiz
•
7th Grade
