Example & Tutorial understanding programming in easy ways.

How do you traverse through a Dictionary object in Python?

program:

d={1: 'First', 2: 'Second', 3: 'Third'}

for key,val in d.items():

     print("Key is ",key)

     print("Value is",val)

Output:

1 First

2 Second

3 Third

Read More →