For Loop:
You can tackle the for loop in the same way as the while loop. As you probably would have expected, the "for" component in "for loop" refers to something that you do for a certain number of times.
If you keep all the above in mind, you can easily define the for loop as follows:
A for loop is a programming concept that, when it's implemented, executes a piece of code over and over again "for" a certain number of times, based on a sequence.
In contrast to the while loop, there isn't any condition actively involved - you just execute a piece of code repeatedly for a number of times. In other words, while the while loop keeps on executing the block of code contained within it only till the condition is True, the for loop executes the code contained within it only for a specific number of times. This "number of times" is determined by a sequence or an ordered list of things.
You'll learn more about the difference between while and for loops in a bit, but for now, concentrate on the following pieces that you need in order to create a for loop:
The for keyword
A variable
The in keyword
The range() function, which is an built-in function in the Python library to create a sequence of numbers
The code that you want to execute repeatedly
Auf dieser Seite können Sie das Online-Video Python for loops tutorial in less than 7 minutes mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Python Soldiers 25 Oktober 2021 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 46 Mal angesehen und es wurde von 3 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!