返回列表 發帖
本帖最後由 歐陽霖 於 2023-7-10 21:14 編輯
  1. englishscore=int(input("請輸入英文成績:"))
  2. chinesescore=int(input("請輸入國文成績:"))
  3. mathscore=int(input("請輸入數學成績:"))
  4. totalscore=englishscore+chinesescore+mathscore
  5. print("總分:",totalscore)
  6. totalscore=totalscore/3
  7. print("平均分數為%.2f"%totalscore)
  8. if totalscore==100:
  9.     print("優等!!")
  10. elif totalscore>=90 and totalscore<100:
  11.     print("甲等!!")
  12. elif totalscore>=80 and totalscore<90:
  13.     print("乙等!!")
  14. elif totalscore>=70 and totalscore<80:
  15.     print("丙等!!")
  16. elif totalscore>=60 and totalscore<70:
  17.     print("丁等!!")
  18. elif totalscore>=0 and totalscore<60:
  19.     print("不及格!!")
  20. else:
  21.     print("輸入錯誤!!")
複製代碼

TOP

返回列表