Week 1: January 30 - February 3¶
This week we get an intensive introduction to Python and to Jupyter Notebook, which will be our main development environment. We also start writing the functions that will be needed for the first assignment.
Week 1 Notebook¶
Introduction to MTH 337¶
- Syllabus
- How the class is structured
- Expectations for the class
Why Python?¶
- Free
- Readable
- Extensible
- Popular
Introduction to Jupyter Notebook¶
- Cells
- The tool bar
- Using notebooks to develop and save code
Introduction to Python¶
- The print function
- Numbers in Python - integers, floats, booleans
- Mathematical operations
- Modulus operator %
- Variable assignment
- The import statement
- Python math module
- The dir function
- Comments
- Boolean expressions
- Conditional code - the if statement
- Loops - the while statement
- Defining functions using def
Greatest Common Divisor and the Euclidean Algorithm¶
The Euclidean Algorithm was invented over 2000 years ago to find the greatest common divisor of two numbers. We learn how the algorithm works, together with the constructs we need to implement the algorithm in Python.