banner



How To Run Python Script On Windows 10

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

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

How to Execute Python Program Using Control Prompt

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

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

Create python file to execute python program.

So, how you can execute the Python program using the command prompt. To see this, you have to beginning open the control prompt using the 'window+r' keyboard shortcut. Now, blazon the word 'cmd' to open the control prompt.
Open cmd prompt to execute python program.

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

Y'all can use the cmd command 'cd' to change the directory location. Apply 'cd..' to come out of directory and "cd" to come up within of the directory. Get the file location where you saved your Python file.

Execute python program using cmd prompt.

To execute the Python file, y'all have to use the keyword 'Python' followed by the file name with extension. Run across the example given in the screen above with the output of the file.

You can too execute the code straight in the interactive mode with the side by side section.

Interactive Manner to Execute Python Program

To execute the lawmaking directly in the interactive way. You have to open the interactive way. Press the window button and type the text "Python". Click the "Python iii.7(32 chip) Desktop app" as given below to open the interactive mode of Python.

Interactive mode to execute Python program.

You can type the Python code directly in the Python interactive fashion. Hither, in the epitome below contains the print programme of Python.

Press the enter push to execute the impress code of Python. The output gives the text '"How-do-you-do World!" subsequently y'all press the enter button.

Interactive mode to execute Python program.

Blazon any code of Python you desire to execute and run straight on interactive mode.

However, you tin can also execute the Python program using the Python GUI. You have to employ the below department 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 Vanquish to execute the Python program on Windows system.

Open up the Python IDLE shell by pressing the window button of the keyboard. Type "Python" and click the "IDLE(Python 3.vii 32 chip)" to open the Python shell.

Interactive mode to execute Python program.

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

Interactive mode to execute Python program.

It contains the unproblematic Python code which prints the text "Hello Earth!". In gild to execute the Python lawmaking, y'all take to open the 'run' menu and press the 'Run Module' choice.

or

You tin can likewise utilize the keyboard shortcut 'F5' to run the Python code file.

Interactive mode to execute Python program.

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

A Python IDLE mode can likewise execute the direct code.

Interactive mode to execute Python program.

To execute the direct code, yous take to write the Python lawmaking directly on the Python IDLE trounce. Here, a print office of Python prints the text "Hello Globe" on execution.

Interactive mode to execute Python program.

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

DOWNLOAD Complimentary PYTHON CHEAT SHEET

Source: https://tutorialdeep.com/python/execute-python-program/

Posted by: hillcloons.blogspot.com

0 Response to "How To Run Python Script On Windows 10"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel