题解 | #梦想的大学#

梦想的大学

http://www.nowcoder.com/practice/f0de95ee47c844e78d70a21f7b2c7911

NP40 梦想的大学

思路:

step1:向字典里加入键值对的方式:survey_dict[name] = university

代码如下:

survey_dict = {}
while True:
    try:
        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?")
        m = input()
        if m == 'No':
            break
    except:
        break

for i in sorted(survey_dict.keys()):
    print("I'am {}. I'd like to go to {} if I have the chance!".format(i,survey_dict[i]))
        
全部评论

相关推荐

点赞 评论 收藏
分享
06-12 16:23
已编辑
小米_软件开发(准入职员工)
点赞 评论 收藏
分享
那一天的Java_J...:他本来公司就是做这个的,不就是正常的游戏客户端和服务器开发,软硬件联动,有啥恶心不恶心的,提前告诉你就是怕你接受不了,接受不了就没必要再往后走流程浪费时间,虽然这公司是一坨。
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务