Page 95 - TP-Play_V-2.0_Book-7
P. 95

2. num = 3.4

                 if num > 0:
                     print("Positive number")
                 elif num == 0:

                     print(“Zero”)
                 else:
                     print("Negative number")

               3. x = 31
                 if x > 10:
                   print("Above ten")

                   if x > 20:
                     print("and also above 20!")
                   else:

                     print("but not above 20.")
                                                                                         21 st
            G.  Competency-based/Application-based questions:                          Century   #Experiential Learning
                                                                                         Skills
                 You were writing a program in which you wanted to execute a particular set of statements depending
               upon a particular test condition. Which type of statement will you use for this?
               ...........................................................................................................................................................................................................


                                                                                   21 st   #Computational Thinking
                                                                                 Century
                                                                                   Skills  #Productivity & Accountability
                                                   In the lab


               Write a program to:
                   Check whether the year input by the user is a leap year or not. (a year is a Leap year, if the year
                 is a multiple of 4 and isn’t a multiple of 100 or if the year is a multiple of 400).
                   Calculate the area of square or circle according to the given input by the user. If the input is 1,
                 then calculate area of square, else find the area of a circle. Ask the user to input the values for
                 square or circle, based on the input.
                  Check if the input number is positive or negative.

                   Input three numbers from the user, then print ‘You Won’ if the sum of input numbers is greater
                 than 1000.




             Teacher's Corner

            1.  Discuss all the topics covered in this chapter with the students.
            2.  Tell the students, how to use indentation to define the body of the conditional statement.
            3.  Discuss the concept of control structures in Python with the students.



                                                                      Conditional Statements in Python       95
   90   91   92   93   94   95   96   97   98   99   100