Python Basics Exercises: Dictionaries (Overview)

In plain English, a dictionary is a book containing the definitions of words. Each entry in a dictionary has two parts: the word being defined, and its definition.

Python dictionaries, like lists and tuples, store a collection of objects. However, instead of storing objects in a sequence, dictionaries hold information in pairs of data called key-value pairs. That is, each object in a dictionary has two parts: a key and a value. Each key is assigned a single value, which defines the relationship between the two sets.

In this video course, you’ll practice:

  • What a dictionary is and how it’s structured
  • How dictionaries differ from other data structures
  • How to define and use dictionaries in your own code

This video course is part of the Python Basics series, which accompanies Python Basics: A Practical Introduction to Python 3. You can also check out the other Python Basics courses.

Note that you’ll be using IDLE to interact with Python throughout this course.

Download

Sample Code (.zip)

2.1 KB
Download

Course Slides (.pdf)

6.1 MB

00:00 Hi, I’m Philip with Re Python, and I’m very excited that you’re joining me today on this very special video course. In this re Python Exercises course, you’ll practice how to use dictionaries.

00:12 Our exercises courses are all about training. You’ll train the process of writing code by solving carefully selected exercises. You’ll also train reading over other people’s code and communicating your thought process.

00:26 Doing all that, you’ll practice the concepts that you’ve learned about in an associated course or tutorial and help make them stick. In the upcoming lessons, I’ll introduce you to task, give you an opportunity to solve them yourself, and then show you step by step how I solved each of them.

00:43 You’ll go through three steps for each task, learn about the exercise code, your own solution, and then you’ll compare your solution with mine. When I walk you through a task, I’ll explain what I do and also why I do it like that.

00:58 That will give you a chance to compare not just our final solution, but also how we got there.

01:05 You’ll start with solving some review exercises in the first section of this course, and then slowly, you’ll build up towards a proper challenge.

01:14 Before starting this course, you should have watched a Python Basics course on dictionaries. If you went through that course, then you’ll be well equipped to solve the tasks that I’ll throw at you in this course.

01:26 The concepts that you’ll practice are creating dictionaries, working with dictionary values, checking the existence of dictionary keys, and iterating over dictionaries.

01:37 If you’re somewhat familiar with these concepts and you want to strengthen your knowledge with some practical programming tasks, then this course is exactly right for you.

01:47 Before you get started, there’s another tiny bit of background for this course, which is that I’ll use IDLE, the Integrated Development and Learning Environment that comes bundled with Python.

01:58 If you’ve gone through the Python Basics courses, then you are already familiar with the tool. If not, then you can check out these associated courses that cover getting started with IDLE.

02:08 If you are just here to train and you’re familiar with other code editors, then feel free to use whatever tool you like to solve the upcoming coding tasks,

02:17 and that’s all there is to say to get you set up. If you’re ready to get started and do some hands-on programming, then see you in the next lesson there. I’ll introduce you to the first exercise to get you warmed up.

Become a Member to join the conversation.