关于HackerRank的Day 8 的思考

社区代码暂时放在这里,之后再来总结

import sys 

# Read input and assemble Phone Book
n = int(input())
phoneBook = {}
for i in range(n):
    contact = input().split(' ')
    phoneBook[contact[0]] = contact[1]

# Process Queries
lines = sys.stdin.readlines()
for i in lines:
    name = i.strip()
    if name in phoneBook:
        print(name + '=' + str( phoneBook[name] ))
    else:
        print('Not found')

猜你喜欢

转载自www.cnblogs.com/tqdlb/p/12299589.html
今日推荐