Profile picture

Professor of Computer Science @ Olin College

Solutions Extension Demo

Last updated: December 24th, 20182018-12-24Project preview

Exercise 1

Write a function add that receives two numbers and returns the sum of them:

In [ ]:
def add(x, y):
    # your code here
In [ ]:
# Tests:
assert add(2, 3) == 5
assert add(4, 3) == 7
In [1]:
def add(x, y):
    return x + y

Markdown cells can also be solutions, for example:

Exercise 2

Use LaTeX math notation, to write out the formula of "sum of squares":

$$\sum_{i=1}^n i^2$$
Notebooks AI
Notebooks AI Profile20060