题解 | #梦想的大学#
梦想的大学
http://www.nowcoder.com/practice/f0de95ee47c844e78d70a21f7b2c7911
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()
break
for i in sorted(survey_dict):
print(f"I'am {i}. I'd like to go to {survey_dict[i]} if I have the chance!")
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?")
#判断是否结束循环
if input() == 'No':break
for i in sorted(survey_dict):
print(f"I'am {i}. I'd like to go to {survey_dict[i]} if I have the chance!")