8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5f551e1 commit bfbe0dcCopy full SHA for bfbe0dc
dictionaryOperations.py
@@ -0,0 +1,34 @@
1
+__author__ = 'Avinash'
2
+
3
+# add elements to dictionary
4
+my_info = {
5
+ 'Name': 'Avinash',
6
+ 'Age': 23,
7
+ 'Gender': 'Male',
8
+ 'Location': 'India',
9
+ 'Website': 'programminginpython.com'
10
+ }
11
12
+# print dictionary
13
+print(my_info)
14
15
+# print value of a key
16
+print(my_info['Name'])
17
18
+# modify elements in dictionary
19
+my_info['Age'] = 24
20
21
22
+# length of dictionary
23
+print(len(my_info))
24
25
+# delete a particular key
26
+del my_info['Website']
27
28
29
+# removes all elements in dictionary
30
+my_info.clear()
31
32
33
+# delete entire dictionary
34
+del my_info
0 commit comments