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

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

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
step 1: Open Python IDLE.
step 2: Click the file menu.
step 3: Click New File to open a new file
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.
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.
Post a Comment