Page 138 - Computer Science Class 11 Without Functions
P. 138

● Using different quotation marks to mark the beginning and end of a string
         print("India')

         print('India")
               -----> the string should be enclosed within the same type of quotation marks
        ● Missing the closing parenthesis
         print(10     ------->  missing ')'

        ● Using incorrect case of a letter:  Print / PRINT
         PRINT('INDIA')       -----> it should be print()


             Let's Summarise


          Ø   The character set of Python includes lower case and uppercase alphabets, digits, symbols, and white space
              characters, and some special characters like _ *$.,?. While naming the objects, the underscore character is
              used like an alphabet.
          Ø   The smallest unit of a program is known as a token or a lexical unit.

          Ø   The tokens in Python are keywords, identifiers, literals, delimiters, and operators.
          Ø   Keywords are reserved words that have a specific meaning for the Python interpreter/compiler.
          Ø   Identifiers are the names or labels used to name a string, number, function, etc., in a program.
          Ø   The name should begin with an uppercase alphabet, lowercase alphabet, or underscore (_).

          Ø   An identifier cannot contain any special symbol except an underscore.
          Ø   A literal denotes a value, also called an object. Examples of literals include 23, 234.67, 'Hello', and "How are
              you".
          Ø   Delimiters are symbols that are used to separate data items.
          Ø   An operator performs a specific operation on the specified values. For example, in the expression 23+4, the
              operator + denotes the addition of the adjacent operands 23 and 4.
          Ø   A variable is a name that uniquely identifies an object.
          Ø   Variable are not declared explicitly in Python. They get associated with a type that is determined implicitly.
              For example, consider the statements,
              x = 23            #s1

              x = 23.25         #s2
              x = 'hello'       #s3
                In statements s1, s2, and s3, the variable x denotes an integer (23), a floating point (23.25), and a string object
              ('hello'), respectively.
          Ø   The nongraphic characters are represented using escape sequences.

          Ø   An escape sequence starts with a backslash (\) followed by one or more characters.
          Ø   Comments are statements that are ignored by the interpreter during the execution of the program.
          Ø   input() is used to accept data input from the user.
          Ø   print() is used to display the output on the standard output device, that is, the monitor.
          Ø   print() without any argument will print a blank line.






         136   Touchpad Computer Science-XI
   133   134   135   136   137   138   139   140   141   142   143