Data Structures are key (pun intended) to mastering Python. In fact, they're so important, we're dedicating an entire 3 days to them!
Even if you're familiar with data structures, this will be a useful refresher.
Watch all of the videos. They'll provide you with the foundation you need to get working with lists, tuples and dictionaries.
Have a play with your own lists, dicts and tuples in the Python shell and familiarise yourself with them.
Feel free to watch the What we learned video as well as a recap!
This will take you to our [Pybites Platform and do this Bite: Query a nested data structure
Follow the on page instructions once you've redeemed the Bite and see if you can solve the problem!
**UPDATE: We decided to wrap the below (and a little more) into a Bite on our Pybites Platform for you. You're still more than welcome to perform the work as per the instructions below, but if you want to try this in a Bite then try it here to redeem the Bite for free.
Create a script that imports the US States data structures contained in the following script file in our Repo: https://github.com/talkpython/100daysofcode-with-python-course/blob/master/days/07-09-data-structures/code/data.py
Perform the following tasks on the list and dict. The less you look at them, the better this exercise will be. Remember: Dicts are unsorted.
-
Print out the 10th item in each.
-
Print out the 45th key in the dictionary.
-
Print out the 27th value in the dictionary.
Be sure to share your last couple of days work on Twitter or Facebook. Use the hashtag #100DaysOfCode.
Here are some examples to inspire you. Consider including @talkpython and @pybites in your tweets.
See a mistake in these instructions? Please submit a new issue or fix it and submit a PR.