How to run Python files
There are three ways to run Python files:
- Using Code Runner
- Using Terminal
- Using IDLE
- In our website (trinket)
1. Code Runner
Writing code and pressing the traingle button will run the code.
However, you cannot type in the code directly.
So, most of the time, you would need to use the Terminal.
print("hello world")
2. Terminal
Terminal is a space for typing commands and running them.
Running the code below will run the hello.py
file.
python hello.py
To open the terminal, follow one of the steps below.
- Press
ctrl + `
(pressctrl
with `) - Terminal > New Terminal
3. IDLE
If you have enabled the 'IDLE' option while installing, you can run python code in the IDLE.
Search for IDLE or double click on one of the shortcuts.
Typing print("Hello World")
and pressing entering will print the result.
4. Trinket (coding-insight.com)
Our site uses the Trinket to run Python code.