Page 92 - KEC Khaitan C8.5 Flipbook
P. 92

OPERATORS
                  Operators are special symbols that are used to perform specific operation on operands and give

                  a meaningful result. Operands are the data involved in the mathematical operation, and may be
                  stored in variables and constants.
                  Combination of variables, constants and operators makes an expression.



                                            Operator             Operator


                  Expression:       a           +          5         =          20



                                 Variable              Constant



                  PUNCTUATORS
                  Punctuators are also called separators as they are used to separate lines of codes, variables, etc.
                  The following characters are used as punctuators in Python: ` # \ () [] {} @ , : . ‘ =

                     Brackets []   indicate list.

                     Parentheses ()   indicate tuples, function calls, function parameters for grouping expressions etc.
                     Comma (,)   is used as a separator in a function argument list or variable declaration.

                     Colon (:)   indicates a labelled statement or conditional operator symbol.
                     Equal sign (=)   is used to initialise the value of variable.




                            DATA TYPES

                  Data types are used to define the type of value a data can contain. Each variable in Python is associated
                  with some data type. Each data type requires a different amount of memory and has some specific
                  operations performed on it.

                  Data types are divided into two categories as shown below:


                                                                      Data Types





                                        Numbers          Sets        Mapping       Sequence       Boolean





                              Integer/long          Float                    String           Lists


                                         Complex                   Dictionary        Tuple




                   90   Premium Edition-VIII
   87   88   89   90   91   92   93   94   95   96   97