Python For Loop Exercises

Python For Loop Exercises

12th Grade

10 Qs

quiz-placeholder

Similar activities

python4-lesson13

python4-lesson13

2nd - 12th Grade

10 Qs

关于网络…

关于网络…

11th - 12th Grade

10 Qs

文法-八大詞類-名詞

文法-八大詞類-名詞

3rd - 12th Grade

5 Qs

雲端從業人員Module 9 知識點檢查

雲端從業人員Module 9 知識點檢查

9th - 12th Grade

10 Qs

微控制器

微控制器

1st - 12th Grade

15 Qs

一維陣列

一維陣列

9th - 12th Grade

10 Qs

5年级TMK:创建数据库

5年级TMK:创建数据库

1st - 12th Grade

6 Qs

4 年级 RBT - Scratch

4 年级 RBT - Scratch

1st - 12th Grade

8 Qs

Python For Loop Exercises

Python For Loop Exercises

Assessment

Quiz

Computers

12th Grade

Hard

Created by

Akirapeter Yong

Used 3+ times

FREE Resource

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

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

5.

DROPDOWN QUESTION

30 sec • 1 pt

Media Image

Fill in the blank to print each element of the list:

补全代码以打印列表中的每个元素:

for fruit in (a)   :

fruit

range(fruits)

len(fruits)

fruits

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

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
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?