Execution of Python Program

 Execution of a Python Program

                    Execution is an important process of each program. It is a process of executing the given instruction on the computer. The execution process has two important steps, that is Compilation or Translation and Answering. In these two steps, compilation or translation is a very important step. Because we write the instructions in English, that is the language we know but the computer knows only binary values. So, we translate the instruction into binary values which are computers known.

Translation of Python Program

simplepycoder.executionofpython                    Many other programming languages are compiled language. But Python is an interpreted language. It does not need compilation to binary. We just run the program directly from the source code. Internally, Python converts the source code into an intermediate form called byte codes and translates this into the native language of our computer, and runs it. This all is done by a piece of software called an interpreter. It also knows as Python Virtual Machine(PVM)

Interpreter

                    The interpreter is the program we'll need to run Python code and scripts. Technically, the interpreter is a layer of software that works between your program and your computer hardware to get your code running.

Answering

                   Answering is a simple process, that is computer gives the result of the given your instructions. after the translation the computer read all the instructions and give the related output. The output is displaying on the computer's monitor.

How to run a Python program?

                    You are able to run Python programs from
  • Command Line Window
  • Python's IDLE
  • Directly from Command Line Prompt

Command Line Window

                    We can get an IDLE and Command-Line Window while installing the Python software on our computer. In Command-Line Window we can easily execute the commands interactively.
step 1: Open the Python's Command Line Window
step 2: Execute any instructions like
                       For Example >>>print("Hello World")
step 3: Press Enter to tell Python that you're done with your command. After within few seconds we can see your answer to your instruction.
Exiting Python: To exit from Python you can type any of these commands.
  • quit()
  • exit()
  • control-z
simplepycoder.command_line_window

 IDLE: Python's Integrated Development Environment (IDE)

                    The IDLE tool is included in Python's installation package but you can choose to download more sophisticated third-party IDEs. We can use the IDLE in two ways. We can use that as a command line window and we also create a Python file and run it in a Python file in IDLE.

steps for creating Python  file in IDLE

simplepycoder.ide










step 1: Open Python IDLE.

step 2: Click the file menu.

step 3: Click New File to open a new file

simplepycoder.IDE1



















step 4: Write the Python program.

step 5: Click the File menu and save the menu to save the file.

step 6: Save the Python file by .py extension 

                                For Example:example.py

step 7: Click the Run menu and Run Module to execute the program.

                    
simplepycoder.ide2









Directly from Command Line Prompt

                    We can also use the system command line prompt to run the Python file. If we install the Python software on our computer.
steps for run Python file in the command line prompt.
step 1: Open Notepad and write the Python program.
step 2: Save it with the .py extension.
step 3: Open the command line prompt.
step 4: Type cd python3 and click enter.
step 5: Type the file name and click enter. we can see the output of the program.

simplepycoder.cmd_prompt


                    

0/Post a Comment/Comments

Previous Post Next Post