Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use a Python dictionary? [closed]

Tags:

python

I am finding it difficult to iterate through a dictionary in python.

I have already finished learning via CodeAcademy and solo learn but still find it tough to go through a dictionary.

Are there any good resources other than official documentation of Python to learn more and given in lucid language where I can be more comfortable with python.

like image 522
niksy Avatar asked Apr 19 '26 04:04

niksy


1 Answers

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}
like image 53
Divyanshu Avatar answered Apr 21 '26 18:04

Divyanshu