You will enjoy WHILE you are here.

--Originally published at Hackerman's house

The while loop is a function that repeats a section of the code. This section will be repeated as long as a condition is repeated.

The syntax used is:

while condition:

Section of the code that will be repeated.

The code I created is used to count from 0 seconds to 15 seconds, I also import a python library in a pretty basic way, but we will see that mastery topic in depth in another blog post. As long as the variable in the program is less than 15, the variable will be printed with a 1 second delay. When the condition no longer is fulfilled you can do that the program does something else with the ELSE function.

While loop

Here is how the actual programm works.

While loop result

And this is the final result.

While loop result

I hope this blog was useful for you.

giphy (4)