返回列表 發帖

if...elif...else



本帖隱藏的內容需要回復才可以瀏覽

  1. score=float(input("請輸入你的成績: "))
  2. if(score>=90 and score<=100):
  3.     print("優等!")
  4. elif(score>=80 and score<90):
  5.     print("甲等!")
  6. elif(score>=70 and score<80):
  7.     print("乙等!")
  8. elif(score>=60 and score<70):
  9.     print("丙等!")
  10. elif(score>=0 and score<60):
  11.     print("不及格!")
  12. else:
  13.     print("輸入錯誤!")
複製代碼

TOP

  1. score=float(input("your score: "))
  2. if(score>=90 and score<=100):
  3.     print("優")
  4. elif(score>=80 and score<90):
  5.     print("甲")
  6. elif(score>=70 and score<80):
  7.     print("乙")
  8. elif(score>=60 and score<70):
  9.     print("丙")
  10. elif(score>=0 and score<60):
  11.     print("不及格")
  12. else:
  13.     print("wrong")
複製代碼
我是眾神之王XXX  I love you
0000000000

TOP

  1. score=float(input("請輸入你的成績: "))
  2. if(score>=90 and score<=100):
  3.     print("優等!")
  4. elif(score>=80 and score<90):
  5.     print("甲等!")
  6. elif(score>=70 and score<80):
  7.     print("乙等!")
  8. elif(score>=60 and score<70):
  9.     print("丙等!")
  10. elif(score>=0 and score<60):
  11.     print("不及格!")
  12. else:
  13.     print("輸入錯誤!")
複製代碼

TOP

  1. score=float(input("請輸入你的成績:"))
  2. if(score>=90):
  3.    print("優")
  4. elif(score>=80 and score<=90):
  5.    print("甲")
  6. elif(score>=70 and score<=80):
  7.    print("乙")
  8. elif(score>=60 and score<=70):
  9.    print("丙")
  10. elif(score>=0 and score<60):
  11.    print("不及格")
  12. else:
  13.    print("錯誤!!")
  14.    
複製代碼

TOP

  1. s=float(input("請輸入成績:"))
  2. if(s>=90 and s<=100):
  3.     print("優")
  4. elif(s>=80 and s<90):
  5.     print("甲")
  6. elif(s>=70 and s<80):
  7.     print("乙")
  8. elif(s>=60 and s<70):
  9.     print("丙")
  10. elif(s>=0 and s<60):
  11.     print("不及格")
  12. else:
  13.     print("error")
  14.    
複製代碼

TOP

返回列表