-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNested Dictionary.py
47 lines (44 loc) · 968 Bytes
/
Nested Dictionary.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
46
47
languages = {
"Hazik" : {
"favourite languages" : ["java","python","c"]
},
"Faik" : {
"favourite games" : ["IT TAKES 2","VALORANT"]
}
}
print(languages)
nested = {
"BGMI" : {
"ID" : {
"LEVEL" : 75,
"NAME" : "FAIK",
"KD" : 5
}
},
"VALORANT" : {
"VID" : {
"NAME" : "RAY",
"LEVEL" : 70,
"KD" : 1.2
}
}
}
print(nested)
def add_new_user(name, langs, exp):
newu = {}
newu["user_name"] = name
newu["favourite_languages"] = langs
newu["experience"] = exp
programming_language.append(newu)
print(newu)
programming_language = [
{"user_name" : "Elshad",
"favorite_languages" : ["Python", "Java", "C#"],
"experience": 10
},
{"user_name":"Renad",
"favorite_languages" : ["Scratch","Python"],
"experience" : 2
},
]
add_new_user("Edy", ["Java", "Kotlin", "Swift"], 10)