python idle在print()函数中抛出错误我不知道为什么继承代码..
password = "cow"
name = input()
input("MR PENGUIN: hello there i am Mr Penguin what is your name? ")
input("well, hello there"+name+"Tell me your password")
input("You: my password is, ")
input("MR PENGUIN: im little defh could you repeat that? ")
input("YOU: my password is, "
print("PC POLICE: STOP! dont ever trust penguins with your data becuase he just told every one that your password is "+ password)
input("Press Enter To Exit")
答案 0 :(得分:2)
您在前一行的input
末尾缺少一个括号。
变化:
input("YOU: my password is, "
为:
input("YOU: my password is, ")
为了记录,您的print
没问题。请注意,当您收到一个神秘的错误时,它通常出现在上一行上。
答案 1 :(得分:0)
这是因为前一行中的input
语句缺少结束语。
应该是:
input("YOU: my password is, ")
而不是
input("YOU: my password is, "