Skip to main content
 首页 » 编程设计

python之在 python 中使用 "does not equal"的最佳方法是什么

2025年05月04日15java哥

我可以使用/导入更好的东西吗?

 while StrLevel != "low" or "medium" or "high": 
        StrLevel = input("Please enter low, medium, or high for the program to work; ") 

请您参考如下方法:

您可以使用not in。

while strLevel not in ["low", "medium", "high"]: