Problem Description
Write a program to form dynamic dictionaries and display it
Input:
1.Get the number of dictionaries
2. The key-value elements for dictionaries
Output:
1. Display dictionaryCODING ARENA
a=int(input())
x=[]
y=[]
d1={}
for i in range(a):
b=int(input())
x.append(b)
for i in range(a):
b=int(input())
y.append(b)
for i in range(a):
d1.update({x[i]:y[i]})
print("The dictionary is")
print(d1)
Test Case 1
Input (stdin)3 153 154 155 351 451 551
Expected OutputThe dictionary is {153: 351, 154: 451, 155: 551}
Test Case 2
Input (stdin)2 10 1000 20 2000
Expected OutputThe dictionary is {10: 20, 1000: 2000}
No comments:
Post a Comment