Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 95 - 2619_PlusGPT V2.1_C-8
P. 95

    3.  age = 34
                           if age >= 18:
                               print("You are eligible to vote.")
                           else:
                               print("You are not eligible to vote.")
                         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 the largest of two numbers.

                        4.   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.

                                                                                        Conditional Statements in Python  93

| 90 91 92 93 94 95 96 97 98 99 100 |