创建空字典survey_dict
survey_dict = {}
创建死循环并进行信息交互
while True:
print('If you have the chance, which university do you want to go to most?')
print('What is your name?')
name = input()
print('Which university do you want to go to most?')
university = input()
survey_dict[name] = university
print("Is there anyone who hasn't been investigated yet?")
answer = input()
if answer == 'No':
break
continue
进行排序并遍历、格式化输出
for i in sorted(survey_dict.items()):
print("I'am %s. I'd like to go to %s if I have the chance!" % (i[0], i[1]))