Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 140 - 2626_South Point_C-7
P. 140

    print("and also above 20!")
                            else:
                              print("but not above 20.")
                         4. a = 200
                          b = 33
                          if b > a:
                            print("b is greater than a")
                          else:
                            print("b is not greater than a")
                                                                                                        Experiential Learning
                          Let's exPLore

                            Surf the Internet and find more programs of looping in Python.

                           teCh PraCtiCe                                                               Computational Thinking

                          Write a program to:

                          1.   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).
                          2.   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.

                          3.  find whether the given character is a vowel or not.

                          4.  check if the input number is positive or negative.

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

                                                             For The Teacher

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

                      138   Premium Edition-VII

| 135 136 137 138 139 140 141 142 143 144 145 |