Page 78 - TP_Prime_V2.2_Class7
P. 78

Warm            Find the error in the following code and rewrite            Century   #Critical Thinking
                                                                                                     21 st
                                                                                                    Skills
                       Up!             the code:

                                       if(age > 18)
                                           print('You are eligible to vote')

                                       else:
           Prime (Ver. 2.2)-VII            print('Not eligible to vote')                                                                                                                                                                                MORE ON PYTHON








                                  Let's Revisit


                  •   Operators are symbols that perform operation on operands to provide result that we
                    expect.
          76                                                                                                                                                                                                                                          77
                  •  Conditional statements are used to control the transfer of the next sequence to execute
                    based on a specific conditional expression.
                  •  Associativity is the term used to determine if the operators are evaluated Left to Right
                    or Right to Left.




                                                     Mind Drill






                      Rapid Fire


                  1.  Tick () the correct option.

                      a.    Which of the following conditional statements is used to test multiple conditions?
                         (i)   if                                           (ii)   if…else

                         (iii)  if…elif…else                                (iv)  All of these

                      b.   What will be the output of the following code?

                         if(True):

                            print(“Hello”)
                        else:

                            print(“Hi”)
                         (i)   Hello                                        (ii)   Hi
                         (iii)  Hello Hi                                    (iv)   Nothing will print
   73   74   75   76   77   78   79   80   81   82   83