Important Notice:

Course Content
Dictionary in Python (Chapter-9) M3-R5
About Lesson

Add Dictionary Element in Python

               Dictionary में element add करने के लिए square bracket([]) में unique key name और उसकी value दी जाती है।

a={50:’Aman’, 51:’Raman’, 52:’Suman’}

print(a)                                                # {50: ‘Aman’, 51: ‘Raman’, 52: ‘Suman’}

print(a[51])                                                           # Raman

print(type(a))                                                        <class ‘dict’>

 

 

Add Dictionary Element in Python

               To add an element to the dictionary, the unique key name and its value are given in square brackets ([]).

a={50:’Aman’, 51:’Raman’, 52:’Suman’}

print(a)                                               # {50: ‘Aman’, 51: ‘Raman’, 52: ‘Suman’}

print(a[51])                                                           # Raman

print(type(a))                                                        <class ‘dict’>

error: Content is protected !!