Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 150 - CodePilot V5.0 C6
P. 150

    LAB LEARNING                                              21 st
                                                                                           Century   #Creativity
                                                                                            Skills  #Technology Literacy
                             1.  Write the following code in a Python script and run it to see the output.
                                (a)  a = 15
                                     b = 6
                                     c = 3

                                     result = a // b + c
                                     print(result)
                                (b)  a = 20

                                     b = 3
                                     result = (a % b) + (a // b)

                                     print(result)
                                (c)  num1 = 9

                                     num2 = 3
                                     num3 = 5
                                     result = num1 * num2 // num3
                                     print(result)
                             2.  Write a Python program:
                                (a)  To convert temperature from Celsius to Fahrenheit.
                                (b)  To convert miles per hour (mph) to kilometres per hour (km/h).

                                (c)  To convert gigabytes to kilobytes.

                                        CODE CHECK                                                   Century   #Critical Thinking
                                                                                                      21 st
                                                                                                      Skills
                         Identify the error in the following code and fix it:
                         (a)  num1 = 10

                              num_2 = 20

                              result = num_1 + num_2

                              print(result)
                         (b)  age = input("Enter your age: ")

                              age_next_year = age + 1

                              print(age_next_year)
                         (c)  1name = "Alice"

                              print(1name)

                       148
                            CodePilot (V5.0)-VI

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