How to Execute a Python Script

Python is an interpreted, high-level, general-purpose programming language that lets you work quickly and integrate systems more effectively. This tutorial will guide you on how to execute a Python script. We are going to follow a simple process to learn how to write and then execute a Python Script.

Step 1: Install Python

If you have not yet installed Python on your computer, visit the Python Official Website to download and install Python.

Step 2: Write a Python Script

Let’s create a simple script to print a line of text on the screen. You can use any text editor (like VS Code or Notepad ++), but ensure to save the file with a .py extension.

Step 3: Save the Python Script

Once you have written your Python script, save the file with a .py extension. In this example, let’s call our file

Step 4: Run the Python Script

Open the command line (CMD for Windows, Terminal for MacOS or Linux), navigate to the directory where you saved your Python file, and use the following command to execute the Python script:

Create a table if necessary

This tutorial does not require the creation of a table. However, if necessary in your Python script, you can create a table using the pandas library in Python. This will not be covered in this tutorial.

At the end of the post, but before conclusion, display the full code if you used any

Here is the full Python script code.


Once you run the script, you should see the following output:

Hello, World!


Well done! You have successfully executed a Python script from your command line. To get started with Python, you can start learning about variable types, control flow, functions, and other core programming concepts. Happy Coding!