Page 111 - TP_Play_V2.1_class7
P. 111

elif (number < 0):

                          print('Negative')

                      else:

                          print('Zero')

                    2. num1 = 8

                      num2 = 5

                      if (num1 % 2 == 0 and num2 % 2 == 0):

                          result = num1 + num2

                          print("The sum is:", result)

                      else:

                          result = num1 * num2

                          print("The product is:",result)

                    3. x = 31

                      if(x > 10):
                          print("Above ten")

                          if(x > 20):

                          print("and also above 20!")

                      else:

                          print("but not above 20.")


                 F.  Find the error in the following code and rewrite the code:
                    1. x = 10


                      if (x > 5):

                      print("x is greater than 5")

                    2. marksObtained = 95


                      if (marksObtained > 90):

                          print(Distinction)










                                                                           Conditional Statements in Python      109
   106   107   108   109   110   111   112   113   114   115   116