照书本上抄的代码,为啥不运行?
responses={}polling_active=True
while polling_active:
name=input("\nWhat is your name?")
response=input("which mountain would you like to climp someday?")
responses[name]=response
repeat=input("Would you like to let another person respond?(yes/no")
if repeat=='no':
polling_active=False
print("\n---Poll Result---")
for name,response in response.items():
print(name+" would like to climb"+response+".")
错误信息:
What is your name?zwg
Traceback (most recent call last):
File "F:/pythonst/mountain_poll.py", line 6, in <module>
name=input("\nWhat is your name?")
File "<string>", line 1, in <module>
NameError: name 'zwg' is not defined
>>>