Example & Tutorial understanding programming in easy ways.

How do you add elements to a Dictionary in Python?

program:

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

print(d)

d[4]="Fourth"

print(d)

output:

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

{1: 'First', 2: 'Second', 3: 'Third', 4: 'Fourth'}

Read More →