Search Header Logo

Python3

Authored by 趙怡梅 趙怡梅

Computers

9th Grade

Used 3+ times

Python3
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

1 min • 1 pt

if input()=1:

    print(int('請問')+"1")

若輸入2

請問輸出為?

提示:注意變數型態

2

'請問1'

"1"

程式錯誤,無法輸出

Answer explanation

If後方應接布林值==而非=

字串'請問'也無法被轉為數字

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

#print('c')

if not (1==1):

    print('a')

else:

    print('b')

print('d')

'''

print('e')

'''

請問輸出包含哪些字母?

提示:注意註解和if….else的用途

bd

acd

bcde

acde

Answer explanation

print('c'), print('e')皆被註解掉了,不會運行

print('a')需要(1==1)不成立才行

所以也不可能運行

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

print(str(not(int('1')==1)))

請問輸出的資料類型為?

提示:逐次處理函數去括號

整數int

字串str

布林值bool

程式錯誤,無法輸出

Answer explanation

int('1')==1

>>>True

not(True)

>>>False

str(False)

>>>字串'False'

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

a=int(input()+input())+int(input())

b="1"+str(a)

print(b)

若分別輸入1,2,3

請問輸出為?

提示:字串相加會合併

16

115

7

1123

Answer explanation

input()+input()

'1'+'2'

>>>'12'

Int('12')+int('3')

>>>15

"1"+str(15)

>>>"115"

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

a=0

b=2

if a>b

    print("a>b")

else:

    print('a不小於b')

請問輸出為?

提示:注意細節

"a>b"

'a不小於b'

False

程式錯誤,無法輸出

Answer explanation

第三行的if缺少冒號

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

in1=int(input('輸入被除數'))

in2=int(input('輸入除數'))

print('商為:'+str(in1//in2))

print("餘數為_____n1%in2))

請問底線處的程式碼應為?

提示:注意括號、引號等需要成對的符號

//

用來求除完後的整數部分

例如7//2

>>>3

%

用來求除完後的餘數

例如11%9

>>>2

 : ',str(i

: '+str(

:"+str(i

: '+int(i

Answer explanation

第四行的

"餘數為

必須要有雙引號結尾

+,都是字串組合之功用,這裡可互換

Str是為了將數字修改為字串,故不可改成int

結尾的i是為了與n1合在一起稱為in1

否則n1為一個未定義的變數

故不可省略

7.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

a=1

b=3

c=a+b+1

print(a+b+c)

請問輸出為?

提示:逐次進行加法

7

8

9

10

Answer explanation

變數c1+3+1

>>>5

輸出為1+3+5

>>>9

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?