Froot Loops! – While & For Loops

--Originally published at TC101 – Peaz Cooper

Well well well! First of all! Ask yourself the following questions:

How can you create a function on python? How can I call it? Why DC Comics doesn’t know how to make good movies? Is it weird to call my function Martha? Together we will learn the answers to these awesome and mind-blowing questions!


In Python 3 there are two types of loops; there is the “for loop” and “while loop” and this one have very similar results and can be used alternately and it works the same way. The use of these loops depends mainly on the programmer preference. Some surveys of python have already stated that the “for loop” is more efficient than the while loop, but as far as I can tell is not always effective.


Let’s start with the While loop: While something is the case, do the following block of code (Sentdex Youtube Tutorials)

screen-shot-2016-09-14-at-23-28-44

As we can see now we have to specify the terms of the while statement:

  • While the condition variable is less than 10 the condition variable will be printed out
  • After printing out the first condition it automatically adds 1 to the current condition.

For loop:

The “For loop” is the idea of a loop with certain commands like in an instruction manual. This loop is used for tasks that have uncertain time frames (if we can call it that way). Once again this example is brought to you by Sentdex Youtube Tutorials.

screen-shot-2016-09-14-at-23-39-36

As I said before this loop can be used for the exact purposes as the while loop.

For further information about this topic be sure to check out this YT channel about Python Basics: https://www.youtube.com/playlist?list=PLQVvvaa0QuDe8XSftW-RAxdo6OmaeL85M


If you follow these steps you’ll be coding like a bawse in no time!!!

#PeazCooperOut #TC101