Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 151 - CodePilot V5.0 C7
P. 151

    LAB LEARNING                                             21 st
                                                                                          Century   #Critical Thinking
                                                                                           Skills  #Technology Literacy
                            1.  Check if a number is divisible by both 3 and 5. Print “Divisible by both 3 and 5” if true;
                                otherwise, print “Not divisible by both.”
                            2.  Ask the user to enter a number and calculate its factorial using a loop.

                            3.  Ask the user to enter the radius of a circle in centimetres, then calculate and
                                display its area and circumference.
                            4.  Take the lengths of the three sides of a triangle in centimetres from the user and display
                                whether the triangle is scalene, isosceles or equilateral.

                            5.  Ask the user to enter two numbers and check if the first number is divisible by the second.

                                       CODE CHECK                                                   Century   #Critical Thinking
                                                                                                     21 st
                                                                                                     Skills
                        Identify the errors in the following Python codes and correct them:
                        (a)  age = 18
                            if age < 21;
                            print("Age is less than 21")

                        (b)  username = "admin"
                            password = "admin123"
                            if username = "admin" and password = "admin123"
                                print("Login successful")
                            else
                                print("Login failed")

                          JOB JUNCTION
                            People who are experts in Python programming may pursue careers as Python Developers,
                            Software Engineers or Data Analysts.

                      PEDAGOGY PATHWAYS

                       «   Discuss all the topics covered in this chapter with the students.
                       «   Demonstrate how indentation is used to define the body of a conditional statement.

                                                                                                                      149
                                                                                               Flow of Control in Python

| 146 147 148 149 150 151 152 153 154 155 156 |