This lesson describes the operation of the two basic forms of Python loops, the while loop and the for loop. A while loop uses a conditional expression and a for loop iterates over a sequence.
- [Instructor] Python has two basic forms of loops, while loops and for loops. A while loop uses a conditional expression to control the loop. When the condition is true, the body of the loop is executed. When the body is complete, the condition is tested again. And if the condition is still true, the body is executed again. The loop continues as long as the condition is true, and when the condition is false, the loop ends and execution continues with the lines of code after the loop.
A for loop uses a sequence, like an iterator or a list, tuple, or other collection type to control the loop. The body of the loop is executed for each item in the sequence, and when the sequence is exhausted the loop ends. We will cover both of these types of loops in this chapter.
- 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.