返回列表 發帖

if...else

本帖最後由 鄭繼威 於 2022-7-19 10:24 編輯

雙向判斷式語法
if (條件式):
    程式區塊一
else:
    程式區塊二


  1. score=input("請輸入你的成績: ")
  2. score=int(score)
  3. if score>=60:
  4.     print("恭喜你!及格了!")
  5. else:
  6.     print("不及格~斬!")
複製代碼

  1. a=int(input("請輸入成績:"))
  2. print("你的成績",a)
  3. if(a>=60):
  4.     print("及格!")
  5. else:
  6.     print("不及格!")
複製代碼

TOP

返回列表