money = input("输入你的钱数") money = int(money) #这是为了money转换成int类型,因为只要用过input函数获取的内容变量永远都是str类型 if money > 500: print("大吃大喝去") elif money > 300: print("吃水果喝啤酒") elif money > 50: print("吃个盖饭") else: print("太穷了")
lst = ["abc","bcd","cde","def","efg"] str = input("请输入你想验证的字符串 : ").lower() if str in lst : print("Yes") else : print("No") #验证某些特定的值不在列表中,用到的是not in str = input("请输入你想验证的字符串 : ").lower() if str not in lst : print("Yes") else : print("No")