写完polling_active = False:之后下一行不论写print语句)还是直接写for循环按回车之后都会报错。可以帮忙解答一下吗。
>>> responses = {}
>>> polling_active = True
>>> while polling_active:
... name = input("\nWhat is your name?")
... response = input("Which mountain would you like to climb someday?")
... responses[name] = response
... repeat = input("Would you like to let another person respond? (yes/no)")
... if repeat == 'no':
... polling_active = False
... for name, response in responses.items():
File "<stdin>", line 8
for name, response in responses.items():
^^^
SyntaxError: invalid syntax
如果不写 if循环后面的代码程序就会运行但是想要达到的显示投票结果的效果就无法实现。
改缩进和拼写都没用
可以告诉我这是咋回事吗