Page 115 - Computer - 6
P. 115

Mind Stretching
            1.  Identify the correct statements in Python among the statements given below:            Logical Thinking
                (a) print(This is a Python statement)
                (b) Count = print(“Enter a number :”)
                (c) Num = input(“Enter a number between 1 and 10 :”)
                (d) print(“My name is”, Name)

            2.  Parag had created a program in Python. When he tried to execute it, Python reported errors in his
                code. Observe the code given below and underline the errors in it. Also write the correct code.

                  # This is a test program                                                          Computational Skills
                  print(“Enter a number : )
                  num1 = input( )
                  print(“Enter another number : ”)
                  num2 = input( )
                  print(“The sum of the numbers is :” Num1 + num2)

            3.  Vaani had learned about Python commands in class. She wanted to try the commands and practice
                them. Which mode of working in Python would suit her purpose?                          Logical Thinking


             Lab Work                                                                               Computational Skills


              A.  Type the following commands at the Python prompt and write the output obtained.
                  (a)  >>> print(“I am learning Python”)
                  (b)  >>> print(40 * 30 + 60/3)
                  (c)  >>> 45 / 15 – 10 * 20
                  (d)  >>> Name = “Aditya”
                     >>> Age = 20
                     >>> print(“Hello”, Name, “, you are”, Age, “years old.”)
              B.  Write code for the following programs in Python.
                  (a)  Accept two numbers from the user in two variables named ‘Number1’ and ‘Number2’. Display the
                     sum, difference, product, and quotient of the two numbers.
                     (Hint: Use the operators +, –, *, and / for the four operations)
                 (b)  Accept the name, class, and marks in four subjects from the user in appropriately named variables.
                     Display a welcome message with the name and class of the user. Also, display the sum and average
                     of the marks entered by the user.


            DISCUSS                                                                                Communication Skills
            DISCUSS
             Discuss with your classmates the differences between creating programs in Scratch and Python.



           TEACHER’S DESK
           TEACHER’S DESK
           Explain to the students the differences between the Interactive mode and Script mode in Python, illustrating
           the benefits of each mode.


                                                                                                             113
   110   111   112   113   114   115   116   117   118   119   120