Introduction to Computer Science Programming with Python
Loops & Iteration Chapter 5
Definite Loops – for loops For loops are easier to validate They are used to a fixed start and end Example, to go through a list, all the lines in a file, or all the characters in a string
Simple for Loop The following loop start from 0 to 10 (it doesn’t execute 10) and print i (counter)
A Simple Definite Loop – the Pythonic way
A Definite Loop with Strings
A Simple Definite Loop – the Pythonic way
For Loops in Most Programming Languages The below example shows a for loop in Java that shows the initialization of the counter that start from 0 to 10, and it increments i (counter) by 1 every iteration. Tip, ++ in most programming languages means +1, but not in Python