Python provides sequential types for many purposes, including both mutable and immutable versions of lists, tuples, and dictionaries.
- [Narrator] Python provides some built-in sequence types,…including lists, tuples, and dictionaries.…Here in Komodo, I've opened a working copy of…sequence.py, from chapter three of the exercise files.…A list is created with square brackets, like this,…here on line four,…and if I save and run this,…you'll notice that we get this result,…I is one, I is two, etc.…The for loop is sequencing through the list,…and for each item in the list,…it assigns I the value of the item,…and I is used in the print function.…
A list is a mutable sequence,…so I can reassign one of the values…after I have assigned it.…I can say X sub two equals three,…and so I'm accessing,…with this index in the square brackets,…I'm accessing a particular specific item in the list.…And I'm going to change its value to 42, like that.…So, when I save and run it,…you'll see that the item number two,…which is the third item, because the index starts at zero…for all sequence types in Python,…and I've reassigned that to the value, 42.…
So, I can say item number zero,…
- 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 Efficiently (2017)with 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.