1 Dec 2020

Python interpreter

             To execute a program in a high-level language by translating it one line at a time.
                       
                            


            

Modes of python interpreter:
    
               Python interpreter is a program that reads and executes python code, it uses two modes of execution,

                    *Interactive mode
       
                    *Script mode

Interactive mode:

               *Interactive mode as the name suggests, allow us to interact with operating system. 
  
                *When we type python statement, interpreter displays the results immediately.

                *Python in interactive mode is good enough to learn, experiment or explore.

                 *Working in interactive mode is convenient for beginners and for testing small pieces of code.

                  * In interactive mode you type python programs and the interpreter displays the result : 
                            >>>1+1
                                   2

The Chevron>>>, is the prompt the interpreter uses to indicate that it is ready for you to enter code. If you type 1+1,the interpreter replies 2.
>>>Print ('Hello,world!')
Hello,world!

Script mode:

           *In script we type python program in a file and then use interpreter to execute the content to the file.
   
            *Script can be saved to disk for future use. Python scripts have the extension  .py, meaning that the file names ends with .py
   
            * Save the code with filename .py and run the interpreter in script mode to execute the script.
 
Program:

        Print(1)
          x = 2
          Print(x)

Output:
>>> 1
       2
       
Integrated Development Learning Environment (IDLE):

         *It is graphical user interface which is completely written in python.
 
         *It is bundled with the default implementation of the python language and also comes with optional part of the python packaging.

             
Features of IDLE :

             * multi-window text editor with syntax highlighting.
      
              * Auto completion with smart intendation.

               * Python shell to display output with syntax highlighting.

               

     
              
                  

No comments:

Post a Comment

Operator precedence

           When an expression contains more than one operator, the order of evaluation depends on the order of operations.            The ac...