Skip to main content

Python 3

Python is an experiment in how much freedom programmers need. Too much freedom and nobody can read another's code; too little and expressiveness is endangered. -- Guido van Rossum

We only use Python 3 at UCL because it’s 2023 and Python 2 is long lost in the past, thank goodness.

caution

Unlike Java JDK versions, Python 2 and Python 3 are separate languages! They differ in syntax and much more!

Install Python​

The simplest way to install Python 3 is to use Homebrew! Open Terminal and run the following command to install Python:

brew install python

Once it's completed (which may take some time!), let's test that Python has been installed correctly.

Type python3 in Terminal. This should open interactive shell, where you can type...

print("Hello World!")

...and expect a kind greeting from your very own Python! Congratulations! 🐍 πŸŽ‰

tip

You can close Python's interactive shell by pressing Ctrl+D or typing exit().

python test git

tip

Although not necessary for using Python, you may find it helpful to install the standard GUI library - tkinter:

brew install python-tk

Set up your IDE​

VS Code is a highly customizable code editor, which has fantastic extensions! Install the official support for Python, which provides you with great code completion, code formatter, framework for testing, debugging, and more!

Python extensions picture

Well done!

You're all set to deal with snakes! 🐍