Key-value pairs in Python are called dictionaries. A dictionary is similar to a hashed list or an associative array in other languages. Dictionary entries are typically accessed by their key.
- [Instructor] Python's dictionary type…is a hashed key value structure.…This is comparable to associative arrays in other languages.…Here in Komodo I've opened a working copy of D-I-C-T,…dictionary, .py from chapter eight of the exercise files…and you notice that the dictionary is created…using curly braces so there's the open curly brace…and the closed curly brace and there's key value pairs.…That's a key value pair.…
Each of the key value pairs has a key on the left,…a value on the right, and they're separated by a colon.…The pairs are separated by commas within the structure sets.…One key value pair, that's another one, and et cetera.…You notice also that I have a little print dict function…which prints the dictionary and when I run it…you can see it prints it in a nice readable format.…You can also create the dictionary…using the dictionary constructor and keyword arguments…and personally I find this a lot more convenient,…and now it looks like this.…
You can see this is a little bit easier to read…and it's a lot easier to type and when we save and run…
- Python anatomy
- Types and values
- Conditionals and operators
- Building loops
- Defining functions
- Python data structures: lists, tuples, sets, and more
- Creating classes
- Handling exceptions
- Working with strings
- File input/output (I/O)
- Creating modules
- Integrating a database with Python db-api
Skill Level Intermediate
Python: Programming Efficientlywith Michele Vallisneri2h 15m Intermediate
2. Language Overview
3. Types and Values
8. Structured Data
11. String Objects
12. File I/O
13. Built-in Functions
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.