Python

Getting started in Python for CS136

We will use Python (specifically, Python 3) for all of the programming problem sets in CS136. If you have absolutely zero experience coding in the language, try this tutorial or reach out to the TFs for more resources.

Installing Python

MacOS

These instructions assume your Mac has not had Python installed on it before.

Conveniently, MacOS comes with Python 3 pre-installed now-a-days.

You can use it by opening terminal and running python3 -V to confirm the installation (should display 3.x.x).

If you find writing out python3 annoying to run a Python 3 script, run

echo -en "\nalias python='python3'\n" >> ~/.zshenv && source ~/.zshenv


Running python -V should now show a 3.x.x version.

Windows

These instructions assume your PC has not had Python installed on it before.

Windows does not come pre-installed with Python, but does have an official distribution now.

To install Python 3, open a command prompt and run python

This will open the Microsoft Store where you can install Python 3.

After it's done installing just open a new command prompt and confirm it worked with  python -V

Linux

You already know how to install Python.

Text Editors

You can get Python support in most modern text editors, but if you already dont have a favorite, here are two options:

For most people reading this, PyCharm is probably what you want. It just works.

Other Resources

As with most programming languages, there is a wealth of documentation online, including the official Python documentation here. Here are a few other useful resources: