为什么当我运行这个代码时,它的第二个块(无论是游泳还是等船)都没有显示



有问题程序的图像,运行时显示";none";当第二个代码块执行时

这是因为您在input()函数中使用了打印函数。请在此处阅读有关input()使用的信息。

正确使用:

choice2 = input("You have arrived at a river bank ...")
choice3 = input("You have arrived at an island ...")

错误使用:

choice2 = input(print("You have arrived at a river bank ..."))
choice3 = input(print("You have arrived at an island ..."))

因为您在输入函数中使用了打印函数。重新排列代码并将语句从打印内容写入输入内容。

正确使用:

input("foo, boo")

错误使用:

input(print("foo, boo"))

删除第二个代码块中的print((:

发件人:

choice2 = input(print("Your questions?n")).lower()

收件人:

choice2 = input("Your questions?n").lower()

使用print((时,问题字符串不会传递给input((,后者会输出None。

相关内容

最新更新