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
Python is great :) tip! link
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Thank you for the tip, friend :)
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Hi @jo3potato! You have just received a 0.1 SBD tip from @cardboard!
From @cardboard: <a href=
@tipU - send tips by writing tip! in the comment and get share in service profit :)
By upvoting this comment you support the service - thanks!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
I'm gonna have to find a day off and start with episode 1. I'd love to get myself a working bot
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Thanks for another lesson of Python
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit