Another thing every programming language must do is to provide a way to perform the same
action multiple times. The keyword for is one one way in which you can loop through code
while executing repeatedly.
For as long as you have more hamburger to eat, keep eating that hamburger.
For loops come in many forms.
You can loop through a list of values. That list is surrounded with square brackets. Each time
through the list the next value will be assigned to the variable I in this example.
CODE
for i in [2,4,6,8,10]:
print("i = ", i)
We can also have the keyword range define our list for us. range(10) will create a list starting at
0 and go up to, but not include 10, the number passed into it.
We can now combine range with a for loop to print the numbers 0 through 4 like so.
In questa pagina del sito puoi guardare il video online For Loop and Range in Python by CodingXpertz della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Coding Xpertz 18 febbraio 2023, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 23 volte e gli è piaciuto 0 spettatori. Buona visione!