Learn how to run Python code?
You can execute Python code from the terminal or from a Python IDE. An IDE is a graphical environment that assitsts in software development.
If you are new to Python, I recommend this course:
How to run Python
All Python programs are written in code, text files with lots of instructions. These are saved with the extension .py.
To run a Python program, you need to have Python installed.
Open a terminal and type:
where file.py is the name of your program. If you have more than one file, the main program is often the name of the program itself;
Use an IDE
Sometimes an easier way to execute Python programs is using a Python IDE. In a Python IDE, you simply press the ‘play’ button.
The image above shows the header of the program PyCharm, a Python IDE. The green play button can be used to start a program.