Simple Python Tutorial to introduce range() with it's parameters

Veröffentlicht am: 06 April 2023
auf dem Kanal: Earth Walker
174
7

Please like the video if it helps you :)

Simple python example and short video to illustrate the use range() to construct a "for" loop to repeat a number of time. It explains the 3 parameters that range() has. We can have a choice of passing in 1 or 2 or 3 input values to range. It further explains how the 3 values affect how the range() functions. The example are focused on helping a beginner understand how to use range() in a "for" loop.

3 parameters of the range()
range( [start], stop, [step] )
the square bracket indicates these parameter are optional. if there are not specified, they take on default value.
[start] default to a value 0.
[step] deafult to a value +1.
so range(5) is effectively equals to range(0,5,+1)
range(1,5) is effectively equals to range(1,5,+1)

After understanding how range() works, you can used it in different situations depending on the need. It is most commnly used to just repeat statement(s) a certain number of times and display a counter as it repeats. On certain occasion, you need odd numbers or even numbers where you can then configure the Change/step.

You can use the link below to see some related videos
(Apart from watching the video, you can also show more info to read on the explanation.)
== More on how "for" loop works ==
   • Simple Python Tutorial to introduce "for" ...  

== how "while" loop works works ==
   • Simple Python Tutorial to introduce "while...  

Hope these inputs are helpful for you.

0:00 - range() and it's 3 parameters
0:59 - range() with 1 input value passed in (most common and simplest)
02:09 - range() with 2 input value passed in
02:47 - range() with 3 input value passed in
03:12 - range() with 3 input value passed in with negative step value

Keywords:
#python
#for
#range()
#parameters
#start
#stop
#step
#change
#repeats
#loop
#loops
#counter
#counter-controlled
#tutorial
#short
#simple
#easy


Auf dieser Seite können Sie das Online-Video Simple Python Tutorial to introduce range() with it's parameters mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Earth Walker 06 April 2023 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 174 Mal angesehen und es wurde von 7 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!