Search Header Logo

Python基礎課程 - 第4課 Python 自動化程式(二)

Authored by Cheung 張祺豐老師

Computers

9th Grade

Python基礎課程 - 第4課 Python 自動化程式(二)
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

9 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

1. 根據 for index in range(0, 4): 指令,在執行最後一次迭代時,index 的值是多少?

A. 0
B. 1
C. 3
D. 4

2.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

2. 根據 for index in range(1, 9, 4): 指令,在執行第二次迭代時,index 的值是多少?

A. 1
B. 4
C. 5
D. 9

3.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

3. 下如果變數 n 的初始值為 2.3,以下那個指令能把輸出內容格式化為整數?

A. print("The answer is %d." % n)
B. print("The answer is %s." % n)
C. print("The answer is %f." % n)
D. print("The answer is " + str(n) + ".")

4.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

Media Image

4. 根據下圖程式,如果變數 n 的輸入值為 3,以下哪項是執行結果?

A. The total number is 1.
B. The total number is 2.
C. The total number is 3.
D. The total number is 6.

5.

MATCH QUESTION

1 min • 1 pt

把以下 Python 的 for 循環指令中不同部分的意思配對起來。

for var in range(1, 8, 2):

print(var)

變數的終止值

1

變數的間隔值

print(var)

變數名稱

8

重複執行的指令

2

變數的起始值

var

6.

MATCH QUESTION

1 min • 1 pt

執行以下的 Python 程式,把 for 循環中不同迭代的輸出配對起來。

start = 12

stop = start + 24

step = 4

for n in range(start, stop, step):

print(n)

16

最後一次迭代時

32

第一次迭代時

12

第二次迭代時

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Python 中,for 循環可用於無限次地重複執行指令。

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?