If 條件子句

If 條件子句

Assessment

Flashcard

Mathematics

University

Hard

Created by

Ariel LU

Used 1+ times

FREE Resource

Student preview

quiz-placeholder

4 questions

Show all answers

1.

FLASHCARD QUESTION

Front

請填寫 if 條件語句來判斷一個數字是奇數還是偶數。

number = int(input("請輸入一個數字: "))

 

if ____________:  # 填入條件

    print("這是偶數")

else:

    print("這是奇數")

Back

number % 2 == 0:

2.

FLASHCARD QUESTION

Front

請填寫 if 條件語句來檢查使用者是否符合投票的年齡(18歲及以上)。

age = int(input("請輸入你的年齡: "))

 

if ____________:  # 填入條件

    print("你可以投票")

else:

    print("你尚未符合投票年齡")

Back

age>=18

3.

FLASHCARD QUESTION

Front

填寫 if 條件來檢查一個數字是正數還是負數。

number = int(input("輸入一個數字: "))

 

if ____________:  # 填寫條件

    print("這是正數")

else:

    print("這是負數")

Back

number >= 0

4.

FLASHCARD QUESTION

Front

填寫 if 條件來檢查學生是否通過(成績 ≥ 60)還是未通過。

score = int(input("輸入你的成績: "))

 

if ____________:  # 填寫條件

    print("你通過了!")

else:

    print("你未通過")

Back

score>=60

Discover more resources for Mathematics