Skip to main content
 首页 » 编程设计

Python之和,或验证

2025年05月04日19bjzhanghao

<分区>

从代码中可以明显看出,但我想检查输入是否不等于这些值而不是再次询问。我认为这行得通,但行不通,而且出现故障,有什么更好的方法来做到这一点?

type=input("Please choose an option: ") 
while type.isalpha() == False: 
    type=input("Please choose an option: ") 
while type != ("a" and "A" and "b" and "B" and "c" or "C"): 
    type=input("Please choose an option: ")