Starting with Python

pythonThis article is not designed to go into great details, but instead it's to help you get up and running as quickly as possible with the python environment.  The first thing to do is download and install Python.  However there are currently 2 versions of Python, versions 2 and 3.  If you already know what version you want to install then go ahead, otherwise we suggest you start with the latest version, you can download Python from here.

Once you have downloaded Python, run the file to install it and follow these simple steps.

Installing Python

  1. Choice the "Install for all users" and click on "Next >".

  2. Unless you wish to install Python else where, leave the default directory and click on "Next >".

  3. You may wish to make a slight change by adding python to the path so you can run your python code from anywhere.  Simple select click on the down arrow in the box with the cross in it, where it says "Add python.exe to Path", then select "Will be installed on local hard drive", followed by clicking on "Next >".

  4. Python has now been installed, complete the install be clicking on "Finish".

Test your Python install

Once installed lets test it is all working by following these further steps.

  1. Right click on your desktop and create a new "Text Document".

  2. Once you have created your new file, rename it with the file extension of ".py" and make sure the icon looks like the below to ensure it is associated with python.

  3. Now lets create some simple code to test all is working.  Right click on our ".py" file and select the new option no available called "Edit with IDLE".

  4. Type the following code into the editor.

    print("Hello World!")
    print("This is my attempt at Python code...")

  5. Run your code by selecting the option as illustrated below.

  6. If you have not already saved your code you will be prompted to as below, simply click on "OK".

  7. If all has been installed correctly you should get a result like below.

Congratulations you have successful installed and tested Python.  The next thing we might want to do is make use of an IDE, such as Eclipse to maximise our coding experience with Python.  We will cover this in another article.

Please note that you can now simply open a command (cmd) window and type "python" to enter the python shell where you can write commands directly into the system.  We will also cover this topic later.