Posted on

Learn Python Episode #12: Dictionaries

Get The Learn to Code Course Bundle!
https://josephdelgadillo.com/product/learn-to-code-course-bundle/

Enroll in The Complete Python Course on Udemy!
https://www.udemy.com/python-complete/?couponCode=PYTHONWP

In this video we will cover dictionaries in Python. In the previous video when we created a list we used square brackets and comma separated values. To create a dictionary we will use curly brackets instead of the square brackets. In a previous video I may have mentioned that we do not use curly brackets in Python, and that was a lie. What I meant is that we don’t need to wrap code blocks in curly brackets like PHP or JavaScript. So, let’s go ahead and define a dictionary.

{"name": "Nick", "age": is 27, "hobby": "code"}

As you can see, instead of just comma separated values we used in the list, the dictionary uses a key and a value separated by a colon. You can access an item in the dictionary like so:

{"name": "Nick", "age": is 27, "hobby": "code"}{"name"}

Python will then print out “Nick.” Dictionaries will be very important when we get to the JSON part of the course, because we will need to parse though a ton of data.

Web – https://josephdelgadillo.com/
Subscribe – https://goo.gl/tkaGgy
Follow for Updates – https://steemit.com/@jo3potato