For Loop and Range in Python by CodingXpertz

Veröffentlicht am: 18 Februar 2023
auf dem Kanal: Coding Xpertz
23
0

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.


Auf dieser Seite können Sie das Online-Video For Loop and Range in Python by CodingXpertz mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Coding Xpertz 18 Februar 2023 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 23 Mal angesehen und es wurde von 0 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!