Hi Everyone,
Today I have tried something with dictionary to get the variables and values . Have a check of how I have done this.
>>> studentnames={'micheal' : 21, 'Ashok' : 22, 'Praveen' : 23, 'Rajesh' : 17}
>>> for items in studentnames:
... print items
...
Praveen
Ashok
micheal
Rajesh
>>> for items in studentnames:
... print items, studentnames[items]
...
Praveen 23
Ashok 22
micheal 21
Rajesh 17
>>>
KeyboardInterrupt
>>>
KeyboardInterrupt
>>>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment