A while loop is way to achieve iteration. Learn how and when to write a while loop.
- [Narrator] Iteration is the process … of repeatedly performing a set of instructions. … A While Loop is another structure that helps … you achieve iteration. … In this video, I will show you … how to write a While Loop. … First, I want to introduce … a helpful function called Len. … Len is a built-in function in Python … that takes in a sequence as input … and returns the length of the sequence as output. … For example, say I have a list of vowels … stored in a variable named vowels, … and I want to know the length of the list. … I would do this. … Vowels equals … A, E, I, O, U. … And the next line, … length equals Len, vowels, … then I print length. … So I'm going to go ahead and run this cell … and I get five. … So the list vowels has a length of five. … Now let's say I want to iterate over the list vowels … and print out each vowel using a While Loop. … I could do this. … Vowels equals, and that part is the same as earlier, … so I'm going to copy paste, … I equals zero, … while I less than Len of vowels, …
This course was created by Madecraft. We are pleased to host this content in our library.
- What is Python?
- Strengths and benefits of Python
- Types of data
- Storing data using variables
- Built-in and custom functions
- Lists and tuples
- Conditional statements
- Iteration with loops
- Recursive functions
- Object-oriented programming
Skill Level Beginner
Learning the Python 3 Standard Librarywith Kathryn Hodge2h 9m Intermediate
Python Standard Library Essential Trainingwith Joe Marini2h 18m Intermediate
1. Defining Python
2. Fundamentals of Programming in Python: Data
3. Fundamentals of Programming in Python: Functions
4. Fundamentals of Programming in Python: Sequences
5. Fundamentals of Programming in Python: Conditional Statements
6. Fundamentals of Programming in Python: Iteration
7. Fundamentals of Programming in Python: Recursion
Define recursive functions6m 13s
8. Quick Intro to Object-Oriented Programming in Python
Next steps1m 8s
- 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.