Page 44 - Modular v1.1 Pyhton
P. 44

range(start, stop): Generates a set of whole numbers starting from ‘start’ to ‘stop–1’.

                      Example: range(3, 9) is equivalent to [4, 5, 6, 7, 8].

                       range(start, stop,  step_size):  By default,  the  value  of  the  step_size =  1  and  numbers
                      generated with a difference of 1. However, we can generate numbers by specifying the value
                      of step_size according to our requirement.

                      Example: range(1, 14, 2) is equivalent to [1, 3, 5, 7, 9,11,13].
                  Program 3: To print your name nine times using for loop with range( ) function.












                  On running the above program, you will get the following output:





















                  Program 4: To print multiplication table of an input number.









                  On running the above program, you will get the following output:























                   42     Touchpad MODULAR (Version 1.0)
   39   40   41   42   43   44   45   46   47   48   49