for Loop in Python
Let’s learn what a for loop is in Python and how to write it.
We'll cover the following...
Previously, we learned how to count lines present in a file. However, our program was reading all the empty lines as well, which resulted in an incorrect output. In this lesson, we’ll learn how to write a for
loop in Python and use it to count the number of lines in a program by ignoring the empty lines.