失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > python写文字冒险游戏手机版_将用户输入转换为小写文字冒险游戏python3

python写文字冒险游戏手机版_将用户输入转换为小写文字冒险游戏python3

时间:2023-11-08 11:44:17

相关推荐

python写文字冒险游戏手机版_将用户输入转换为小写文字冒险游戏python3

我为另一个简单的问题道歉,但我真的被卡住了…我正在尝试添加一个.lower()方法来将任何用户输入(无论是大写、小写还是组合)转换为小写。在

我只是不知道在哪里添加.lower()?在

这是游戏的主要功能:def main():

for turn in range(20, 0, -1):

print("")

describe()

cmd = input("Enter your command " + str(turn) + "> ")

if cmd == "quit":

print("You gave in so easily :-(")

break

elif cmd.startswith("go "):

where = cmd[3:]

move_cmd(where)

if state == "dead":

print("you are dead")

elif state == "outside":

print("You jimmy the door open with the crowbar and escape to your freedom!")

break

elif cmd.startswith("take "):

obj_name = cmd[5:]

take_cmd(obj_name)

else:

print("I do not understand '" + cmd + "'. Try go/take/quit")

print("Game over")

if __name__ == "__main__":

main()

所以我认为这是一行代码来添加它…但它不起作用。。。在

^{pr2}$

这不起作用…我需要添加另一个循环或改变代码行吗?在

提前谢谢你。在

如果觉得《python写文字冒险游戏手机版_将用户输入转换为小写文字冒险游戏python3》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。