當我運行這個,如果我鍵入聊天它從上面的笑話運行punchline如何解決這個問題? enter image description herePython的笑話或聊天錯誤
print ("whats your name?")
firstname = input()
print ("hello,", firstname)
print ("what's your surname?")
surname = input()
fullname = (firstname +" "+ surname)
print ("hello,", fullname)
print ("what shall i call you on a daily basis?")
name = input()
print ("Glad to meet you,", name)
print ("is there anything you would like to do?")
print (" you can 'hear a joke' or 'have a chat'")
question = input("joke or chat?")
if question == "joke":
print("what do you call a deer with no heart?")
idk = input()
print ("Dead!!! LOL!!!!")
if question == "chat":
print("what games do you like?")
game = input()
print ("NO way i love,", game)
看起來它正在做它應該做的事情,但我很驚訝它甚至會在縮進時運行。由於python沒有大括號,正確縮進塊。 – Li357
哪個版本的python? –