
Python For Loop Exercises

Quiz
•
Computers
•
12th Grade
•
Hard
Akirapeter Yong
Used 3+ times
FREE Resource
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
Similar Resources on Wayground
10 questions
11202.WedCh08_240327

Quiz
•
12th Grade
13 questions
11202.FriCh07

Quiz
•
12th Grade
13 questions
Software Engineering

Quiz
•
KG - Professional Dev...
14 questions
C1互聯網及其應用(1):互聯網協定(2)

Quiz
•
9th - 12th Grade
12 questions
A1資訊處理:2.2數據控制

Quiz
•
9th - 12th Grade
15 questions
Python Function Quiz

Quiz
•
12th Grade
12 questions
算法設計 - 數據類型/布爾算式/偽代碼/流程圖

Quiz
•
9th - 12th Grade
10 questions
二進制與十進制轉換測試

Quiz
•
9th Grade - University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade