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.
Here is how the actual programm works.
And this is the final result.
I hope this blog was useful for you.
P.D: The gif was created using Gyazo a really useful tool to print the screen as a Gif or as an image. And the video I saw to understand this is this one. https://www.youtube.com/watch?v=jSs58VZVLw8
September 15, 2016 at 7:40 AM
I really liked you pun at beginning, you explain really good the subject. its clear and consistent ive been strugling with whiles in python but now its all clear thanks to you
LikeLike