Marquette University, view of Wisconsin Avenue  

Module 1

Python is a modern programming language that is heavily used for Data Science, but also in many other applications. Among all other programming languages, the easy to read Python scripts stands out. It is a scripting language, meaning that a Python program is executed in a virtual environment. As a consequence, Python can be used on all systems where such a virtual environment has been implemented.

Getting Python

To obtain Python, go to python.org and download the correct installer for your Operating System. Select the latest release of the Python 3 major version. If you have a Mac, some version of Python 2 is already installed on your system, but you still have to get Python 3. This will install an Interface called IDLE, which we are going to use in this course. If you are familiar with programming, you could do everything using Juypiter notebooks, installing Anaconda, or some similar interface. At the very end of the class, we will look at Python's graphical interface called tkinter, at which point you should switch to IDLE.

Python's strength comes from the many extension modules such as NumPy, Scikit-learn, etc. If you continue with Python, you will install pip to make downloading modules easier, but this is not going to be the topic of this class. Do not worry about this, this bridge is easy to cross when you come to it.

First Scripts

IDLE allows to use the Python Virtual Environment in an interactive manner. At this point, we can use it as a type of desk-top calculator. When you try out, you can use the operators +, -, *, /. Other operators that you should get familiar with over the next weeks are integer division //, taking the remainder modulo a modulus, and the power operator **. These are not the only operators, but we will not use them in this class.

To create a script, you need to create a text file with an extension ".py". In Python, white spaces, i.e., where you begin a line are very important. For this reason, you should use the editor that comes with IDLE. You invoke it by clicking on the File -> New File tabs. If you want to suffer, you can also use any other text editor, even Notepad.