if语句的案例 #案例1 a = int(input("请输入1-10之间的一个数字")) if a == 5: print("恭喜你,猜对了!!") elif a > 5: print('猜大了!!') else : print('猜小了!!') 请输入1-10之间的一个数字5 恭喜你,猜对了!! #案例2 fruits = ['苹果','香蕉','南果梨','火龙果'] fruit = input('请输入水果的名字:') if fruit in fruits: print('有货,马上给你拿!!') else: print('不好意思,没货!!') 请输入水果的名字:大蒜 不好意思,没货!! score = int(input('请输入(1——100)之间的分数:')) if score>0 and score < 60: print("不及格!!") elif score >=60 and score < 70: print("及格!!") else: if score >= 70 and score <80: print("成绩良好!!") elif score >= 80 and score <90: print('成绩优秀!!') else: print('别人家的孩子!!') 请输入(1——100)之间的分数:90 别人家的孩子!!