Python Code Runner

You can use this Python online editor to execute your Python programs. Step-1 Type your source using available text editor in this Online Python Compiler. Step-2 Click Run to get the Output from this Python Interpreter Online. Note: Before Compilation and using this Python IDE online, you must know about Python. Write and run Python code using our online compiler (interpreter). You can use Python Shell like IDLE, and take inputs from the user in our Python compiler.

Python Runner is a handy tool for learning Python or running Python script for daily tasks. Simply type Python code and press 'Command-R' to run it, that is all! You don't event need to save the file first!. Type and run Python code instantly. Display output as plain text or HTML. Running Python Scripts ¶. Create and select your python environment (See the instructions here.) Create a new file via ctrl+N. Press ctrl+s to save the file and give it a name with.py extension. Write down your python code in the file. Press ctrl+alt+N to run the code via Code Runner. You should see your results in the integrated terminal 🛬.

In this tutorial, learn how to execute Python program or code on Windows. Execute Python program on Command prompt or use Python IDLE GUI mode to run Python code.

Create your file in .py extension and execute using the step-step process given here. The steps are given here with pictures to learn in the easiest way.

How to Execute Python Program Using Command Prompt

If you want to create a Python file in .py extension and run. You can use the Windows command prompt to execute the Python code.

Here is the simple code of Python given in the Python file demo.py. It contains only single line code of Python which prints the text “Hello World!” on execution.

So, how you can execute the Python program using the command prompt. To see this, you have to first open the command prompt using the ‘window+r’ keyboard shortcut. Now, type the word ‘cmd’ to open the command prompt.

This opens the command prompt with the screen as given below. Change the directory location to the location where you have just saved your Python .py extension file.

Python Code Runner

You can use the cmd command ‘cd’ to change the directory location. Use ‘cd..’ to come out of directory and “cd” to come inside of the directory. Get the file location where you saved your Python file.

To execute the Python file, you have to use the keyword ‘Python’ followed by the file name with extension. See the example given in the screen above with the output of the file.

You can also execute the code directly in the interactive mode with the next section.

Bonus: download a Free Python cheat sheet that will show you 20+ most important examples to learn in Python.

Interactive Mode to Execute Python Program

To execute the code directly in the interactive mode. You have to open the interactive mode. Press the window button and type the text “Python”. Click the “Python 3.7(32 bit) Desktop app” as given below to open the interactive mode of Python.

You can type the Python code directly in the Python interactive mode. Here, in the image below contains the print program of Python.

Press the enter button to execute the print code of Python. The output gives the text ‘”Hello World!” after you press the enter button.

Type any code of Python you want to execute and run directly on interactive mode.

However, you can also execute the Python program using the Python GUI. You have to use the below section and follow the examples with pictures.

Using IDLE(Python GUI) to Execute Python Program

Another useful method of executing the Python code. Use the Python IDLE GUI Shell to execute the Python program on Windows system.

Python Code Runner Download

Open the Python IDLE shell by pressing the window button of the keyboard. Type “Python” and click the “IDLE(Python 3.7 32 bit)” to open the Python shell.

Idle Python Download

Create a Python file with .py extension and open it with the Python shell. The file looks like the image given below.

It contains the simple Python code which prints the text “Hello World!”. In order to execute the Python code, you have to open the ‘run’ menu and press the ‘Run Module’ option.

or

You can also use the keyboard shortcut ‘F5’ to run the Python code file.

A new shell window will open which contains the output of the Python code. Create your own file and execute the Python code using this simple method using Python IDLE.

A Python IDLE mode can also execute the direct code.

To execute the direct code, you have to write the Python code directly on the Python IDLE shell. Here, a print function of Python prints the text “Hello World” on execution.

Hope, you like this tutorial of how to run Python program on windows.