Page 71 - Information_Practice_Fliipbook_Class11
P. 71

A print() can continue in the next line by using a backslash (\). For example:
                   >>>print("Come and \              Backslash at the end does not
                   complete your work", end='###')
                   Output:                           allow the print() to terminate
                   Come and complete you work###




                    1.  Which statement is included but not executed in the program?
                    2.  In a Python program, which function is used to accept input from a user?
                    3.  What will be the output produced on the execution of the following statement?
                          >>> print('Two','plus','two', sep='#',end=' is four')


            Common Errors

            Using keywords as variable names
            if = 10 → if is a keyword
            Missing quotation marks for strings
            print(India) → string value not enclosed in quotation marks
            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  lowercase  and  uppercase  alphabets,  digits,  symbols,  whitespace
                  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.



                                                                                    Basics of Python Programming  57
   66   67   68   69   70   71   72   73   74   75   76