L-oopsie

--Originally published at Just A Turtle Coding.

In Python, you have 2 types of loops. Both have different uses, Some you use when you know what and how many times you want it, other you use them when you’re like me, you don’t know how many times you’ll want it.

  • For Loops: you use these types of loops when you know what you wanna do and how many times you wanna do it. When you are planning your day, you know how many hours you’re supposed to work (maybe you work those hours, or maybe less hours but you know how many time you’d be supposed to work).
    In this example, you have a set and you wanna know how many of them are pairs. You use a for loop since you wanna only use that set.

And the result: 

  • While loops are a little bit different. A while loop needs a boolean conditional to work. You wanna do something as long as a condition is achieved, while I’m alive I know I wanna make Owner happy so my while loop would be like:
    Turtle = alive
    while Turtle = alive:
           print(”Turtle wants you to be happy”)

If you wanna learn more about this, check out these videos

For loop:

While loop: