How to get started with Python


Python is one of the most in demand programming languages right now being used for web site development, big data, data science and quick applications its appeal continues to grow rapidly. One of the big benefits is that it easy to pick up even for a complete newcomer to development.

Whereas the syntax can be picked up quickly, setting up a development environment for Python can be a challenge to the beginner. So many different versions, how to setup an IDE, how to run an application being but a few. We aim to help answer those questions and more to help you start at full speed into your Python journey.

So, what is Python?

The official Python website describes it as:

Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built-in data structures, combined with dynamic typing and dynamic binding, make it incredibly attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together.

Python org

Now for those who are new to development you might be ready to shut down and walk away, but not to fear we have a simplified version:

Python is a programming language which allows you to create applications quickly, it can be used to integrate existing applications or exist in its own right. When you run a Python application you use the Python executable so it cannot run on its own, you must have Python installed (more on that to come).

Python is loosely typed, and now the English version… Python unlike some other programming languages (e.g., C++) does not care about what types you want to use. So, you can create a variable called Name and set it to “Bob” and then later you can set Name to 523. Python will let you do it which makes it remarkably simple and powerful. Though if you are not careful you can get into a bit of a mess if you don’t keep track of things. You can put types in Python, but they are optional and down to personal preference.

Getting setup

The first choice you have with Python is which version to use if you read around online there has been lots of discussions about using specific versions. So, let’s keep this one easy, just go with the latest long term service version. Python 3 has now been around a long time, is stable and receives the patches and bug fixes which you will want.

So now we have a version, how do you get it installed? Now there are a few options here but again this is a beginners guide so we are going to keep it simple, you can download Python directly from their website. Python works on several operating systems so just grab the right one for you (it should be a case of just hitting the big yellow button).

Some of the steps which follow are on Windows, if you are using a different OS then there might be some differences. If you get stuck, then please feel free to add a comment or contact us and we will be happy to help.

Installing Python

Start by running the installer you downloaded in the last step. Before you go flying through on the first screen before clicking on “Install now” make sure you check the “Add Python.exe to PATH”, this will save you a lot of trouble later. Then click on install now and accept any prompts. Once the install is complete you can just click Close. Now Python is installed we better check it is working, it doesn’t have its own UI so the easiest way to do this is in the command prompt.

Load up a command prompt (a quick way of doing this is by pressing Win+R, type cmd and hit enter). Once it is open just enter python –version if Python is installed correctly (and assuming you checked the add to path option on the last step) then you will be presented with the word Python and a version number.

You now have Python installed but it isn’t really much use without a code editor or IDE. Unless you already have one installed then we will run through installed Visual Studio Code and executing your script.

Visual Studio Code

Visual Studio Code is a free IDE from Microsoft, it is much more light weight than Visual Studio and should be everything you need for Python development. Just head over to the Visual Studio Code install page here and click on the download link for Windows. It is a straightforward installer so you can just click next and accept until it is complete. If it doesn’t launch after the install or to open it in the future, then just search for VSCode on your start menu and it will pop up.

Visual Studio Code is friendly to use for beginners. Unlike IDEs like Visual Studio, you will be working directly in a folder (no solutions or project files here), there are workspaces but that is for another day. From the first screen select Open Folder… (you can also find this on the file menu). Create a new folder anywhere you like for this tutorial. Then click on Select Folder and it will load up. You will probably be prompted asking if you trust the authors, as it is you then I will let you decide. On other words select yes, the big blue button.

We won’t go into details of the layout here; we can just get a quick Python application going. If you put your mouse over the new folder name on the left, you will notice a new icon appear. Click on the one furthest left which creates a new file. Feel free to name it what you like ending with .py, this is the extension used by Python.

In the editor window just enter:

print("Hello world!")

You should now have something which looks like this:

Running your application

To run our one liner, click on the plus icon on the menu on the left, then click on the Run and Debug button. A menu will pop down from the top, you can simply press enter or select “Python File”.

Once it runs you will see a terminal pop up from the bottom of the screen and if it worked the 2nd from last line from the bottom will read “Hello World”. Good news, you have made it and Python is working.

If you’re wondering what next then why not head over to our guide on using Git with Visual Studio Code.

The icons in this page come from which is a great source of icons for many purposes.

Leave a Reply

Your email address will not be published. Required fields are marked *

WordPress Cookie Plugin by Real Cookie Banner