12-1:分數等第

Chinglin-K


目錄:Dice 程式教學-Python完整版
上一篇:11-3:逛牛墟
下一篇:12-2:年齡說


題目

寫一個程式讓使用者輸入分數,印出分數等級。
如 100 到 90 之間是等級 A,其餘類推如下:
89-80 B
79-70 C
69-60 D
59-0 F

輸入範例:
85
輸出範例:
Your score is 85 and degree is B!


程式碼

n = int(input()) if (n <= 100 and n >= 90): print(f"Your score is {n} and degree is A!") elif(n>=80): print(f"Your score is {n} and degree is B!") elif(n>=70): print(f"Your score is {n} and degree is C!") elif(n>=60): print(f"Your score is {n} and degree is D!") else: print(f"Your score is {n} and degree is F!")

輸出


目錄:Dice 程式教學-Python完整版
上一篇:11-3:逛牛墟
下一篇:12-2:年齡說


「盡多少本分,得多少本事」😊