How to use a Python dictionary? [closed]

Lots of different documentations and tutorial resources available for Python online, almost each of them are helpful depending upon your need. But most reliable documentation is official documentation of Python website.

Also please watch youtube videos of the same, many videos of practical implementation of dictionaries and other Python constructs are available in easy to understandable manner.

Here is sample program for dictionary implementation:

my_dict = {'name':'Deadpool', 'designation': 'developer'}
print(my_dict)
Output: { 'designation': developer, 'name': Deadpool}

# update value
my_dict['designation'] = 'sr developer'

#Output: {'designation': sr developer, 'name': Deadpool}
print(my_dict)

# add an item to existing dictionary
my_dict['address'] = 'New York'  
print(my_dict)
# Output: {'address': New York, 'designation': sr developer, 'name': Deadpool}

Leave a Comment