forked from Durgaprasad-Dev/BasicsofPython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDictionaries.py
More file actions
36 lines (35 loc) · 853 Bytes
/
Copy pathDictionaries.py
File metadata and controls
36 lines (35 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
32
33
34
35
36
#ordered key value pairs
contacts={
"Jyothirani":{"phonenumber":7731808882,"email":'g.s.jyothirani'},
"Prasad":{"phonenumber":7731808882,"email":'durgaprasad888@gmail.com'}
}
print(contacts["Jyothirani"])
sentence="i like the jishnav because the name jishnav is the best"
word_count={
"i":1,
"jishnav":2,
"like":1,
"the":3,
"because":1,
"name":1,
"is":1
}
#get list of tuples of key value
print(list(word_count.items()))
#get list of keys
print(list(word_count.keys()))
#get list of vaules
print(list(word_count.values()))
#Add an item into dictionary
print()
print(word_count)
word_count["best"]=1
print(word_count)
#Delete an item from dictionary
print(word_count)
print()
word_count.pop("the")
print(word_count)
#Delet last item
print(word_count.popitem())
print(word_count)