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.
Unlike Java JDK versions, Python 2 and Python 3 are separate languages! They differ in syntax and much more!
Install Pythonβ
- Homebrew
- Python.org
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! π π
You can close Python's interactive shell by pressing Ctrl
+D
or typing exit()
.
Although not necessary for using Python,
you may find it helpful to install the standard GUI library - tkinter
:
brew install python-tk
If you prefer to download Python from the official Python website, visit the Downloads page!
Set up your IDEβ
- VS Code
- JetBrains PyCharm
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!
PyCharm is a powerful IDE, with lots of useful built-in tools! Assuming you've already got your JetBrains Toolbox (if not, check this out!):
- Open the JetBrains Toolbox and install PyCharm Professional, once opened it should automatically find your Python environment.
You're all set to deal with snakes! π