-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path8_dictonary.py
45 lines (34 loc) · 913 Bytes
/
8_dictonary.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Dictonary:
# key alwasy be in string
# key: value
smallDict = {'name': 'Daksh', 'course': 'Python'}
# Print only course:
# smallDict['course']
print('\nCoure name: ', smallDict['course'])
# doble layer dictonary:
midDict = {
'personalInfo': {
'name': 'Dakhs',
'age': {
'origanl': 28,
'dublicate': {
'dub1': 20,
'dub2': 18,
'dub3': 15,
},
},
},
'proInfo': {
'school': 'ABC'
}
}
# print('\nAge: ', midDict['personalInfo']['age']['origanl'])
print('\nAge: ', midDict['personalInfo']['age']['dublicate']['dub3'])
# cahnge dub3 age form 15 to 16
midDict['personalInfo']['age']['dublicate']['dub3'] = 16
print('\nAge: ', midDict['personalInfo']['age']['dublicate']['dub3'])
# midDict.
# Home work:
# check all dictonroy realted mehtos
# learn about set
# condition: if else