Skip to main content

How to run Python files

There are three ways to run Python files:

  1. Using Code Runner
  2. Using Terminal
  3. Using IDLE
  4. 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")

Result

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.

  1. Press ctrl + ` (press ctrl with `)
  2. Terminal > New Terminal

Terminal

Result

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.

IDLE

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.