Page 117 - Computer Genius Class 08
P. 117

Initially, the value of variable ‘a’ was 10. Later it’s
                 changed to 20.

                 Python Keywords

                 Python has a set of keywords that are reserved words and has a special meaning. They cannot be used
                 as variable names, function names, or any other identifiers.  ome of the keywords are as follows


                                false           class           finally            is            return

                                none          continue            for           lambda            try

                                true             def             from          nonlocal          while

                                and              del            global            not             with

                                 as              elif             if              or             yield


                               assert            else           import           pass            raise

                               break           except             in


                 Comments in Python

                 When working with any programming language, it is recommended to include comments in the code
                 to annotate your work.
                 Single-line  comments  are created  simply by starting  with  the  hash  ‘#’ character,  and  they  are
                 automatically terminated as the line ends.

                 Example:

                 #This is a comment

                 Python Operators

                 Operators  are  special symbols in Python  that
                 carry  out  arithmetic  or  logical  computation.
                 The  value that  gets operated  on is called  an
                 ‘Operand’.  For example:  2+3=5,  here, 2 and 3
                 are ‘Operands’. The symbol ‘+’ is known as the
                 ‘Operator’.

                 There  are  various  types of Operators  used in
                 Python, some of them are listed here:

                 l  Arithmetic Operators.
                 l  Assignment Operators

                 l  Comparison Operators




                                                                                            Basics of Python  115
   112   113   114   115   116   117   118   119   120   121   122