Python Getting Started

In this tutorial, we will learn how to run a Python program on our local computer. We have two different ways to run a Python program. First, we can install any Python IDE, so we don’t need to explicitly install Python. The second is to install Python on our local computer itself. Let’s discuss each method one by one.

1. Installing any Python IDE

Using a Python IDE(Integrated Development Environment) is the easiest way to run a Python program. There are a lot of free Python IDE available. In this tutorial, we will use Thonny IDE, which is basically dedicated to beginners. This IDE comes up with the latest version of Python bundled in it, so you don’t need to install Python separately.

Follow the below steps:

  1. Download Thonny from its official website.
  2. Once it’s downloaded, right-click on the executable file and click on Run as administrator.
  3. Move forward by selecting each step and at last click on the Install button.
  4. Once it’s installed, launch the application.
  5. Go to File> New File and then save this file as .py extension. You can name it whatever you want but don’t forget to add .py at the last.
  6. Now you are ready to write your first program.
Python Getting started

7. After writing your program, click on the Run icon(play button) or press F5 and you can see the output in the bottom Python shell.

2. Installing Python on Our Local Computer Separately

In the first method, we have discussed how we can run a Python program without explicitly installing Python. If you are not willing to use any separate IDE, you can install Python and run your Python program. Here is how:

  1. Download Python from its official website.
  2. Launch the installer, move forward step by step and install it.
  3. Once it’s installed completely, add PATH to Python, so that you can run Python commands from anywhere. You can set the PATH by adding Python to the environment variables.
  4. Now open the command prompt and type python –version. If you see the Python version after hitting the python –version command, everything is fine now. If not, you need to set the PATH properly. Refer below image.
Install Python

5. Now as everything looks good. you can type the command Python in your command prompt. Once you hit the Python command it will immediately run in interpreter mode and you can run any Python code here. See the below example:

Download and install Python

Note: Use command exit() to come out of the Python interpreter mode.

Now that we have seen how we can run our program using the command prompt. But wait, wouldn’t it be very difficult to write multiple lines of program in command prompt? To avoid such a difficulty, we can use any text editor to write our programs and we can use command prompt to run it.

Follow below steps:

  1. Write your program in any text editor you want.
  2. Save the file with .py extension.
  3. Open the command prompt and move to the saved file path.
  4. Run the command python on that path.
  5. After hitting above mentioned command you can see the output.
Python getting started

First Python Program

Now that we have learned how to run a Python program. It’s time to create our first Python program. Let’s create a very simple hello world program. Actually, the hello world program is used to introduce a new programming language to beginners. Let’s get started.

Type the below code in any text editor or IDE you are using and save it as

print('hello, world!!!')

Run the file.


hello, world!!