Learn Python Episode #12: Dictionaries

in technology •  8 years ago 

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.

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

Best,
Joseph Delgadillo
Web: https://josephdelgadillo.com/
YouTube: https://www.youtube.com/c/JosephDelgadillo
Steemit: https://steemit.com/@jo3potato

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Python is great :) tip! link

Thank you for the tip, friend :)

Hi @jo3potato! You have just received a 0.1 SBD tip from @cardboard!

From @cardboard: <a href=

rel="noopener"> Cute Kittens!!!

@tipU - send tips by writing tip! in the comment and get share in service profit :)
By upvoting this comment you support the service - thanks!

I'm gonna have to find a day off and start with episode 1. I'd love to get myself a working bot

Thanks for another lesson of Python