I am working with python 3.1.1 Below is my code and this works well.
But how to insert a new item in the above dictionary.
If i tried with, say
dict['anotheritem']['nested']='true' , it gives error...
Also help me in printing the elements using Loop
Code:
dict={'paul':{'age':23,'hobby':'computer','like':'music'}}
print (dict['paul']['hobby'])
If i tried with, say
dict['anotheritem']['nested']='true' , it gives error...
Also help me in printing the elements using Loop
Comment