Chapter 6 Repeatition
Chapter 6 Repeatition
For loop
A for loop is a Python statement which repeats a block of code a specified number of
times.
Range!
The list can be not only the numbers, but also something else.
Range (omitting Step)!
For in Range
Note that range command doesn’t accept floating point and string parameters
Nested-For
While Loop!
Random
We can get all the functionalities in the module into our program by importing it with
import command.
import random
randint(a,b) The function will return a random integer number that are in between a
and b, inclusively.
The following example shows simple structure of the while loop. The condition (5>4) is
always true, so the word “Superman” will be printed infinitely.!