python - 其他声明表现得好像它不存在
问题描述
嗨,我是 python 新手,我正在编写这个快速项目,但是每当我在代码中添加一个 elif 语句时,它会完全忽略 else 语句并打印打破循环的 elif 语句有人知道为什么吗?
user_input7 = input("What is my favorite game?")
while True:
if user_input7 =="Hint" or user_input7 == "hint":
print("The first two letters of the first word start with ho.")
user_input7 = input("What's my favorite game?")
continue
elif user_input7 == "idk" or user_input7 == "i dont know":
print("uh if you don't know it type hint")
user_input7 = input("What's my favorite game?")
continue
elif user_input7 == "Hollow Knight" or "hollow knight" or "Hollow knight":
print("About time you got that one")
break
else:
print("Why isn't this working")
解决方案
推荐阅读
- c# - Unity Physics.Raycast 在应该检测到对象时未检测到
- javascript - 如何让我的消息正确显示?
- java - 由于“包 javafx.collections 不存在”错误,Maven 无法编译
- python - 在 Colab 中同时运行多个单元
- visual-studio-code - Visual Studio Code 快捷键不适用于外部键盘
- embedded-linux - 嵌入式 Linux 上的热插拔以太网上没有 IP 地址
- javascript - X 和 Y 滚动条都可用时的对角线滚动
- sql - 如何重置主详细信息页面上的搜索项?
- react-native-web - 使用本机反应在固定时间内从零高度动画到动态目标高度
- flutter - 如何识别哪些颤振包阻止其他人更新到最新版本?