8000 Create Day 8.md · iaman877/Programming-with-Python@c59f10b · GitHub
[go: up one dir, main page]

Skip to content

Commit c59f10b

Browse files
authored
Create Day 8.md
1 parent 3275f5f commit c59f10b

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

30 Days of Code HackerRank/Day 8.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Day 8: Dictionaries and Maps
2+
3+
```
4+
import sys
5+
6+
# Read input and assemble Phone Book
7+
n = int(input())
8+
phoneBook = {}
9+
for i in range(n):
10+
contact = input().split(' ')
11+
phoneBook[contact[0]] = contact[1]
12+
13+
# Process Queries
14+
lines = sys.stdin.readlines()
15+
for i in lines:
16+
name = i.strip()
17+
if name in phoneBook:
18+
print(name + '=' + str( phoneBook[name] ))
19+
else:
20+
print('Not found')
21+
22+
```

0 commit comments

Comments
 (0)
0