About Lesson
Traversing a Dictionary:-
Dictionary से प्रत्येक value को access करने के लिए for in loop का use कर सकते हैं।
You can use for in loop to access each value from the dictionary
d={10:’Atul’,11:’Vimal’,12:’vishal’,13:’Vikash’} for x in d: print(d[x]) Output: Atul Vimal vishal Vikash |
d={10:’Atul’,11:’Vimal’,12:’vishal’,13:’Vikash’} for x in d: print(x) Output: 10 11 12 13 |
d={10:’Atul’,11:’Vimal’,12:’vishal’,13:’Vikash’} for x in d: print(x,”:”,d[x]) Output: 10 : Atul 11 : Vimal 12 : vishal 13 : Vikash |