5- Run a Python program

5- Run a Python program

For short commands, we do not need to write scripts. We use the command line:

In the search window of Windows, write:

cmd

Then press Enter to open the command prompt.

To open Python, inside the command prompt, write:

python
print("Hello World!")
### Hello World!

To close the Python, use:

exit()

To write a simple python file:

Open Notepad, inside Notepad, write: print("Hello, World!"), then save it as helloworld.py.

To run a Python file on the command line: Change the directory to the folder (e.g., Python38) that includes the file, then use the command:

cd C:\Python38
python helloworld.py

Output:

Hello, World!

Congratulations, you have written and executed your first Python program.

If you find this content helpful, please consider SUBSCRIBING to my channel for future updates.

If you would like to get the full video tutorial and a certificate, you can enroll in the course by following this link: https://www.udemy.com/course/python-for-researchers/?referralCode=886CCF5C552567F1C4E7