tutorialsPythonBasic.verybasic.loops.for module¶
Created on 2014-09-16 :author: Natan Žabkar (nightmarebadger)
A for loop is usually used when we want to repeat a piece of code ‘n’ number of times, or when we want to iterate through the elements of a list (or something similar).
In this example our program will ‘sing’ out the 99 bottles of beer song (http://en.wikipedia.org/wiki/99_Bottles_of_Beer). We use .format() to put the number of bottles in the text and we use an if sentance for the last two verses.