Page 47 - 2501_KVS_C-8
P. 47

3.    range(4,1,-1):

                                A.   4 3 2 1                               C.   4 3 2
                                B.   4 3 2 1 0                             D.   None


                         4.    range(1, 4,2):
                                A.   1 3                                   C.   1 3 4
                                B.   1 2 3 4                               D.   None

                         5.    range(-5,3):

                                A.   -5 -4 -3 -2 -1 0 1 2                 C.   -5 -4 -3 -2 -1 0 1
                                B.   -5 -4 -3 -2 -1 0 1 2 3               D.   None
                   D.    State whether these statements are true or false.

                         1.      ‘range()’ function is used to generate some numbers in a given
                               range of values.                                                        _________

                         2.      To use the ‘range()’ function, lower-limit as well as upper-limit
                               values must be passed in it. s                                          _________

                         3.    We cannot pass a skip value in the ‘range()’ function.                  _________
                         4.    Lower-limit value cannot be less than 0.                                _________

                         5.    Upper limit value must be a positive value.                             _________






                            Something to Do


                   Write a statement in Python using range() function to print the following output:

                         a.    1 2 3 4 5

                         b.    1 3 5 7 9
                         c.    2 4 6 8 10 12 14

                         d.    4 7 10 13 16 19 22
                         e.    5 4 3 2 1

                         f.    10 8 6 4 2

















                                                                     Logical Operators in Python                    45
   42   43   44   45   46   47   48   49   50   51   52