本帖最後由 歐陽霖 於 2023-7-10 21:14 編輯
- englishscore=int(input("請輸入英文成績:"))
- chinesescore=int(input("請輸入國文成績:"))
- mathscore=int(input("請輸入數學成績:"))
- totalscore=englishscore+chinesescore+mathscore
- print("總分:",totalscore)
- totalscore=totalscore/3
- print("平均分數為%.2f"%totalscore)
- if totalscore==100:
- print("優等!!")
- elif totalscore>=90 and totalscore<100:
- print("甲等!!")
- elif totalscore>=80 and totalscore<90:
- print("乙等!!")
- elif totalscore>=70 and totalscore<80:
- print("丙等!!")
- elif totalscore>=60 and totalscore<70:
- print("丁等!!")
- elif totalscore>=0 and totalscore<60:
- print("不及格!!")
- else:
- print("輸入錯誤!!")
複製代碼 |