-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdictionaryfuncs.py
More file actions
31 lines (30 loc) · 853 Bytes
/
dictionaryfuncs.py
File metadata and controls
31 lines (30 loc) · 853 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
dictionary={}
d2={}
keys=list(map(str, input("Enter the keys: ").split()))
#keys=keys.split(" ")
for i in keys:
print("Enter value for key "+i+": ")
y=input()
dictionary.update({i: y})
for x,y in dictionary.items():
print(x+" : "+y)
for x in dictionary.keys():
print(x)
for y in dictionary.values():
print(y)
d2=dictionary.copy()
print("Is there any new key that you want to enter?(Y/N)")
a=input()
if (a=='y'or a=='Y'):
k1=list(map(str, input("Enter new keys: ").split()))
for i in k1:
print("Enter value for "+i+" : ")
y=input()
d2.update({i:y})
elif(a=='n' or a=='N'):
print("Okay!")
for i in d2.keys():
if(i in dictionary.keys()):
print(i+" is found in both dictionaries")
else:
print(i+" is unique to dictionary two")