0% found this document useful (0 votes)
70 views4 pages

Python WS2 ANS

This document is a Python 2 worksheet for a Grade 3 computer studies class. It contains multiple choice questions testing if/else conditional logic and programming exercises. The questions cover topics like checking if a number is even or odd, comparing input values, and determining the greatest of three numbers. Students are asked to write Python programs that read integer input and use if/elif/else statements to analyze and output the values. The exercises focus on fundamental programming concepts like user input, conditional logic, and simple number comparisons.

Uploaded by

Chun Piu Wong
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views4 pages

Python WS2 ANS

This document is a Python 2 worksheet for a Grade 3 computer studies class. It contains multiple choice questions testing if/else conditional logic and programming exercises. The questions cover topics like checking if a number is even or odd, comparing input values, and determining the greatest of three numbers. Students are asked to write Python programs that read integer input and use if/elif/else statements to analyze and output the values. The exercises focus on fundamental programming concepts like user input, conditional logic, and simple number comparisons.

Uploaded by

Chun Piu Wong
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Python 2 Page 1 (4)

香海正覺蓮社佛教馬錦燦紀念英文中學
中三電腦科工作紙
Python 2: 邏輯運算,if…elif…else
日期: ___________
學生: ________________________ 班別: __________ ( )

A. 多項選擇題 (4 分, @1 分)
1. 以下 Python 程式的輸出是什麼?

choice = 1
if choice == 1:
print("I like Computer Studies")
else:
print("I hate Computer Studies")

A. I like Computer Studies


B. I hate Computer Studies 改正:
C. I like IT
A
D. I hate IT

2. 以下 Python 程式的輸出是什麼?

choice = 2
if choice == 1:
print("I like Computer Studies")
else:
print("I hate Computer Studies")

A. I like Computer Studies


B. I hate Computer Studies 改正:
C. I like IT
B
D. I hate IT
Python 2 Page 2 (4)

3. 當輸入的值是 10 時,以下 Python 程式的輸出是什麼?

number = int(input("Enter a number: "))


if number % 2 == 0:
print("It is an even number")
else:
print("It is an odd number")

A. 0
B. 10 改正:
C. It is an even number
C
D. It is an odd number

4. 當輸入的值是分別是 12 和 10 時,以下 Python 程式的輸出是什麼?

number1 = int(input("Enter first number: "))


number2 = int(input("Enter second number: "))
if number1 - number2 <= 0:
print("Number 1 is less than or equal to number 2")
else:
print("Number 1 is not less than number 2")

A. 0
B. 10 改正:
C. It is an even number
D
D. It is an odd number
Python 2 Page 3 (4)

B. 編程 (8 分)
1. 編寫一個 Python 程式讀取一個整數值,然後顯示該輸入數是正數、負數還是零。

number = int(input("Enter a number: "))


if number > 0:
print("It is positive number.")
elif number < 0:
print("It is negative number.")
else:
print("It is ZERO.")
Python 2 Page 4 (4)

2. 編寫一個 Python 程式讀取三個整數值,然後找出三個輸入數中最大的那個數。

a = int(input("Enter 1st number: "))


b = int(input("Enter 2nd number: "))
c = int(input("Enter 3rd number: "))
if a>b and a>c:
print("The greatest number is", a)
elif b>a and b>c:
print("The greatest number is", b)
else:

print("The greatest number is", c)

You might also like