標題:
if...elif...else
[打印本頁]
作者:
tonyh
時間:
2022-1-27 09:16
標題:
if...elif...else
本帖最後由 tonyh 於 2022-1-27 10:04 編輯
score=input("請輸入你的成績: ")
score=float(score)
if score>100:
print("輸入錯誤~斬!")
elif score>=90:
print("優")
elif score>=80:
print("甲")
elif score>=70:
print("乙")
elif score>=60:
print("丙")
elif score>=0:
print("不及格")
else:
print("輸入錯誤~斬!")
複製代碼
score=input("請輸入你的成績: ")
score=float(score)
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("輸入錯誤~斬!")
複製代碼
score=input("請輸入你的成績: ")
score=float(score)
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("輸入錯誤!")
複製代碼
作者:
富溢
時間:
2022-1-27 09:40
score=input("請輸入你的成績: ")
score=float(score )
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("輸入錯誤!")
複製代碼
作者:
胡孟涵
時間:
2022-1-27 09:43
score=input("請輸入你的成績:")
score=float(score)
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("輸入錯誤!!!")
複製代碼
作者:
林柏諺
時間:
2022-1-27 09:53
本帖最後由 林柏諺 於 2022-1-27 09:55 編輯
score=input("請輸入你的成績: ")
score=float(score)
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("輸入錯誤!")
複製代碼
作者:
黃裕恩
時間:
2022-1-27 09:54
score=input("請輸入你的成績: ")
score=float(score )
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("輸入錯誤!~笑死你")
複製代碼
作者:
林柏勳
時間:
2022-1-27 09:57
score=float(input("請輸入成績:"))
if score>=90 and>=100:
print("優")
elif score>=80 and>90:
print("甲")
elif score>=70 and>80:
print("乙")
elif score>=60 and>70:
print("丙")
elif score>=0 and>:60
print("不及格")
else
print("輸入錯誤~斬")
複製代碼
作者:
張仲言
時間:
2022-1-27 10:07
score=(input("請輸入你的成績"))
score=float(score)
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("輸入錯誤~斬!")
複製代碼
作者:
尤宸于
時間:
2022-1-27 10:09
score=input("請輸入你的成績:")
score=float(score )
if(score>=100 and score<=100):
print("你可以去考門薩了")
elif(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>=30 and score<60):
print("不及格~")
elif(score>=0 and score<30):
print("你需要去讀啟智學校")
elif(score>=101 and score<300):
print("你腦子壞了")
else:
print("給我去精神病院")
複製代碼
作者:
張效騫
時間:
2022-1-27 10:10
score=input("請輸入你的成績: ")
score=float(score )
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("輸入錯誤!")
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2