Curriculum

Topics we teach — and have taught

These pages summarise how Exact Science structures olympiad-style mathematics and programming: the core ideas, worked theory, and problem sets we have used in classes over the years. Many topics now also have interactive practice on Problems.cc.

Browse interactive lessons

Programming

Python from first programs through to the ideas we use in maths-and-coding classes.

All levels

Programming

Intro to Python

This course will focus on learning programming using the Python language . This is a modern programming language that works on all common operating systems.

Programming

Arithmetic Operations

Programming

Data Types

So, we see that Python can work with at least two types of data - numbers and strings. Numbers are written as a sequence of digits; there may also be a minus sign in front of the number, and strings are written in single quotes. 2 and '2' are different objects, the first object is a number and the second is a string. The + operation works differently for integers and for strings: for numbers it is addition, and for strings it is concatenation.

Programming

Type Conversion

Sometimes it is useful to write an integer as a string. And, conversely, if a string consists of numbers, then it is useful to represent this string as a number so that you can then perform arithmetic operations with it. For this purpose, functions of the same name as the type name are used, that is, int, float, str. For example, int('123') will return the integer 123, and str(123) will return the string '123'. Example:

Programming

Data Input: input() function

The example above is inconvenient because the source data for the program is specified in the program text, and in order to use the program for another triangle, it is necessary to correct the program text. This is inconvenient; it is better that the program text does not change, and the program asks the user for the data necessary to solve the problem, that is, it asks for the values ​​of two initial variables a and b. To do this, we will use the function input(), which reads a line from the keyboard and returns the value of the read line, which we will immediately assign to the variables a and b:

Programming

Data Output: print() function

The function print can output not only the values ​​of variables, but also the values ​​of any expressions. For example, the entry print(2 + 2 ** 2).

Programming

Our First Program

Let's calculate the length of the hypotenuse of a right triangle from its legs. Launch a text editor and write the following text:

Programming

Boolean in Python

Programming

Cascading Conditional Statements in Python

Programming

Conditional Statements in Python

Programming

Logical Operators

Programming

Nested Conditions

Programming

Turtle: Pong Game

Build Pong in Python with Turtle Graphics