Skip to content
Snippets Groups Projects

Python Quick-Start Guide

What is Python?

Python is a high-level, interpreted programming language. Most of you should be familiar with Java, Python and Java are similair in the sense that they are both high-level. However, Java is a compiled language (meaning that it is turned into CPU instructions before being run) while Python is an interpreted language. Java is also statically typed (Meaning you have to assign a variable type explicitly) while Python is dynamically typed (Python itself decides which variable type you want to use)

Downloading Python

You can go to python.org to download the latest version of Python for your system, installation is pretty simple you just double click the downloaded file and follow the instructions on-screen.

But how do I begin?

You don't really need anything other than a text editor to begin developing in Python. In the end as long as you have a text file with the correct text in it (and the correct file extension) the python interpreter will be able to run it which you can do from the terminal like so:

Python running in the Command Line

Ok but... I don't want to use Notepad for this

That's fair enough, just because you can do something doesn't mean you should. Editing with Notepad is a hassle that you probably don't need. Fortunately, Python has many IDEs (Integrated Development Environments, Think Eclipse, NetBeans, IntelliJ from your Java classes). Here are a couple that I know about, but if you Google around I'm sure you can find more.

IDLE

IDLE is a very, very simple IDE that comes with every Python installation, if you have downloaded Python then you have downloaded IDLE. It gives you some basic IDE features like syntax highlighting and running the code but it's not that useful for anything more than learning to code.

IDLE running on Windows

Visual Studio Code (VSCode)

VSCode is a code editor developed by Microsoft that is known for it's wide compatibility with lots of different programming languages. It's core strength is consistency when developing in lots of different languages at once but it suffers from not being specialised.

VSCode Running on Windows

To get set up on Python in VSCode:

  • Install Python:

    • Ensure Python is installed on your system.
    • python.org
  • Install VS Code:

  • Open VS Code:

    • Launch the application.
  • Install the Python Extension:

    • Go to the Extensions view by clicking on the square icon on the sidebar
    • Search for 'Python'.
    • Install the Python extension by Microsoft.
  • Open Your Python File:

    • Open the folder containing your script or create a new Python file.
  • Run the Script:

    • Right-click in the editor and select "Run Python File in Terminal"
    • or
    • Use the play button on the top-right corner of the editor. This will execute the script in the integrated terminal.

PyCharm

PyCharm is a highly advanced IDE created by JetBrains. It will be very familiar to those of you who are used to working with IntelliJ, it has a lot of features designed to make developing in Python easier (such as more powerful AutoComplete, integration with Git). As Strathclyde Students, you even get access to the more powerful version of it for free!

Getting started is very simple, make sure you have Python installed go to jetbrains.com/pycharm and download it from there.

Once it's installed you can just follow the on-screen instructions to make a new project and press on the green play-button to run it.

Using Python

I'm gonna throw up a second file that goes through basic Python syntax very soon, either later this evening or tomorrow morning. In the meantime I hope this small write up and the video have helped you in some way. Good luck with the labs, if you have any questions:

pat.prochacki@strath.ac.uk