我是 Python 的新手。我有以下 if 语句:
if(userGuess == "0" or userGuess == "1" or userGuess == "2" or userGuess == "3" or userGuess == "4" or userGuess == "5" or userGuess == "6" or userGuess == "7" or userGuess == "8" or userGuess == "9"):
print("\n>>>error: cannot use integers\n")
continue
基本上,如果用户输入任何数字,循环将重置。有什么办法可以写出这个语句来让它更高效一点吗?(即更少的代码和更清洁)
慕尼黑的夜晚无繁华
郎朗坤
慕哥6287543
相关分类