Introduction to Python and setup.

In this class, we will be using the Python programming language. In this first week, we will have a basic introduction to Python and to the fundamentals of computer programming.

Before we get started programming, we have to set up a system to write our code and get the computer to read it. Most introductory Python texts, including the texts we'll be working with, ask you to install an "interpreter"---a program on your own computer that can read and execute Python code. We won't be doing that here.

Instead, all your code will run in the cloud. The University of Iowa has a system that allows us to have access to a running Python environment online. This system will let you type in and execute your code online, through your web browser. This has some very large advantages:

  • You don't have to install anything locally, which can be problematic (especially for Windows users), and I don't have to try to debug your local installations.

  • The system runs on notebook software called Jupyter which is built for data analysis (all the cool data scientist kiddos use it), so it has lots of nice facilities for exploring data and code incrementally, visualizing data, displaying tables, etc.

We'll get set up with all this stuff on the first day of class. Please bring a computer to class every day. Macs, Windows computers, and Linux computers will all work fine (though if you're a Linux user, you might be too advanced for this class). We can make Chromebooks work too if need be (but it is far from ideal).

When we set up, you'll be going to https://notebooks.hpc.uiowa.edu/ and logging in with your HawkIDs. Note that you will need to be set up to use Duo two-step security to get this to work.

Advanced user note

You can, if you choose, also install a local Python environment. If you want to install locally, here's what you should use:

  • Install the Anaconda Python distribution for your operating system. This is important: you want to use the Python 3.7 version of the installer, not Python 2.7.

  • If you want to do this, I'll help as much as I can, but you should know how to use the command line for your operating system. If you use Windows, I won't be able to help you as much as if you use a Mac or Linux. For Windows users, you might try setting up the Windows Subsystem for Linux and installing Anaconda through the instructions in this article, but I can't promise this will work. For Chromebook users, you probably won't be able to install Python locally unless you have a Pixelbook or some other Chromebook that supports Crostini.

  • In additional to installing Python, you'll probably want a good development-quality text editor if you get into programming outside of Jupiter notebooks. I recommend Atom or VS Code, both of which should work on Mac, Windows, or Linux.

Download lesson PDF

links