Page Contents (hide)
Python has two modes for executing programs. The first is the “normal” or interpreted mode in which a Python script or source file is executed via an interpretor. The interactive mode provides a command shell for entering and executing single statments or small segments of code.
Python is an interpreted language and was originally designed for scripting tasks. A Python program is commonly constructed by using a text editor or Python IDE to create a text file containing the instructions. The text file or source file, which should have a .py
extension, is then executed using a Python interpretor.
Assume the following program was created and stored in the text file hello.py
.
To execute the program, enter python hello.py