Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 151 - 2633 Trackpad Pro V5.1 Class 7
P. 151

    c.  Which of the following is not a Python keyword?
                            (i)  assert                                 (ii)  import

                           (iii)  nonlocal                              (iv)  integer
                        d.  Compute x // y if x=15 and y=4.
                            (i)  3.75                                   (ii)  3.5

                           (iii)  3                                     (iv)  4
                        e.  Which data type can store multiple values of different data types ?

                            (i)  Integer                                (ii)  Float
                           (iii)  List                                  (iv)  Boolean

                     2.  Fill in the blanks using the words from the help box.

                                                 Logical, Boolean, Underscore (_), Floor

                        a.   An identifier in Python must start with a letter or an _______________.

                        b.  _______________ errors in Python are related to the logic of the program and do not typically cause
                          the program to crash.

                        c. The symbol // in Python is used for _______________ division.

                        d. A constant like True or False is classified as a _______________ literal in Python.

                     3.  Write 'T' for true and 'F' for false.

                        a.  Identifiers in Python can start with a digit.
                        b.  Keywords in Python are predefined reserved words that cannot be
                           used as identifiers.

                        c.  The constant 12j represents a string literal in Python.

                        d.  Run-time errors occur during the execution of the program and can cause it to crash.

                     4.  Think and answer.
                        a.  What is the difference between an identifier and a keyword in Python?

                         ______________________________________________________________________________________

                         ______________________________________________________________________________________

                         ______________________________________________________________________________________

                        b.  Define a constant in Python.
                         ______________________________________________________________________________________

                         ______________________________________________________________________________________

                         ______________________________________________________________________________________

                                                                                        Tokens and Data Types in Python  149

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