Python Interpreter mode

                                                              Python Interpreter mode 


     The Python interpreter is a program that reads and executes Python code, in which Python statements can be stored in a file.  The Python system reads and executes the commands from the file, rather than from the console.  Such a file is termed as Python program.

     

     Depending on the  environment, start the interpreter by clicking on an icon, or by typing python on a command line.  When it starts. the output  will be shown in     Fig.1


Python 3.6.0 Shell

          Python 3.6.0 (v3.6.0:41df79263all, Dec  23 2016, 07:18:10)  [MSC v.1900 32 bit (Intel)]  on win32

          Type "copyright",  "credits" or "license()" for more information. >>> |

                                                       Python Interpreter Window 


*          The first three lines contain information about the interpreter and the operating system it is running on .

*          The version number is 3.6.0. It begins with 3, if the version  is Python 3.  It begins with 2, if the version is Python . 

*           The last line >>>is a prompt (chevron) that indicates that the interpreter is ready to enter code.  If the user types a line of code and hits Enter, the interpreter displays the result:

  

     In the interpreter or script mode. a Python program (script) is written in a file,  where file name has  extension ".py".   The Python script is executes by the Python interpreter.  By default,  the Python script are saved in the Python installation folder .  Once the script is created,  it can be executed again and without retyping .  The Scripts are editable.  


     To execute  a script,  Type the file name  along with the path at the pormpt.  For example.  if the name of  the file is sum.py, we type


                                          >>>python sum.py 

                                                      Enter 2 numbers

                                                      6

                                                      3

                                                      The sum is 9  .

Comments

Popular posts from this blog

Health is wealth meaning

Guessing an Integer Number in a Range in Python

Think today speak tomorrow..