From the course: Python for Non-Programmers
Unlock the full course today
Join today to access over 25,200 courses taught by industry experts.
For loops - Python Tutorial
From the course: Python for Non-Programmers
For loops
- [Instructor] In this video, about for loops, you're going to really understand how cool and powerful programming is. A for loop in Python allows us to execute the same chunk of code over and over and over again. So let's go ahead and create our very first for loop. And we do this by typing out lowercase for space, and then we create a variable name, which just for the time being, let's say is number. And then we're going to say in space and then provide a range, lowercase, and let's put a number in here, I'm going to say 10, and then I'm going to provide a colon. And then on the next line, you can see that it's tabbed over. We're moved over a little bit. I'm going to print out just simply the term, hello. So before we dive into what a for loop is and how it works, I think just hitting the Run button will really aluminate what's happening here. If we hit Run, look what happened? The term, hello, got printed 10 times.…