本帖最後由 彭郁程 於 2022-8-19 10:34 編輯
1.- score=int(input("請輸入你的成績"))
- print("你的成績為",score,sep="")
- if (score<60) :
- print("不及格")
- elif(score>=60 and score<=100):
- print("及格!")
- else:
- print("無效!最高分數為100!")
-
複製代碼 2.- # -*- coding: utf-8 -*-
- """
- Created on Fri Aug 19 10:28:38 2022
- @author: student
- """
- score=int(input("請輸入你的成績: "))
- if score>=90 and score<=100:
- print("優等!")
- elif score>=80 and score<90:
- print("甲等!")
- elif score>=70 and score<80:
- print("乙等!")
- elif score>=60 and score<70:
- print("丙等!")
- elif score>=0 and score<60:
- print("不及格!")
- else:
- print("輸入錯誤!")
複製代碼 3.- a=int(input("請輸入國語成績 "))
- b=int(input("請輸入英文成績: "))
- c=int(input("請輸入數學成績: "))
- sum=a+b+c
- avgr=sum/3
- print("總分%d平均:%.2f"%(sum,avgr))
- if avgr>=90 and avgr<=100:
- print("優等!")
- elif avgr>=80 and avgr<90:
- print("甲等!")
- elif avgr>=70 and avgr<80:
- print("乙等!")
- elif avgr>=60 and avgr<70:
- print("丙等!")
- elif avgr>=0 and avgr<60:
- print("不及格!")
- else:
- print("輸入錯誤!")
複製代碼 |