Page 46 - 2501_KVS_C-8
P. 46

Let us revise what we have learnt:
                  Ø  Logical operators in Python evaluate and combine conditions for real-world applications.

                  Ø   The ‘NOT’ operator reverses the truth value of a single condition, making True become
                       False and vice versa.
                  Ø   The ‘AND’ operator returns True only if all conditions are True; otherwise, it returns
                       False.
                  Ø   The ‘OR’ operator returns True if at least one condition is True; otherwise, it returns
                       False.

                  Ø   The range() function generates a sequence of integers between a specified lower limit
                       and upper limit, with a default step of 1.

                                                            Exercise



                           Something to know

                    A.    Answer the following questions:

                          1.    Write the use of range() function with the help of an example.
                                ________________________________________________________
                          2.    What do you mean by lower-limit and upper-limit in a range() function?
                                ________________________________________________________

                          3.    What is a skip value in range() function? Write one example of it.
                                ________________________________________________________
                          4.      Can range() function print the following output? If yes, then write its command
                                using range() function.

                                                          10 9 8 7 6 5 4 3 2 1
                                ________________________________________________________

                    B.    Fill in the blanks.
                          1.    In the statement range(1, 10, 3), 3 is a ____________ value.
                          2.    In the statement range(1, 10, 3), 10 is  ____________ value.
                          3.    In the statement range(1, 10, 3), 1 is  ____________ value.

                          4.    The output of the statement range(1, 10, 3) is ____________.
                    C.    Predict/Select the correct OUTPUT for each question.
                          1.    range(1,5):

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

                          2.    range(5,12,3):
                                 A.   5 6 7 8 9 10 11 12                    C.   5 8 11
                                 B.   5 6 7 8 9 10 11                       D.   None



                44                         KVS DELHI REGION 2025
   41   42   43   44   45   46   47   48   49   50   51