Python example
Download exercises zip
Example of notebook for exercises in Python files
What to do
unzip exercises in a folder, you should get something like this:
python-example
python-example.ipynb
lab1.py
lab1_test.py
lab1_sol.py
lab2.py
lab2_test.py
lab2_sol.py
jupman.py
my_lib.py
open the editor of your choice (for example Visual Studio Code, Spyder or PyCharme), you will edit the files
lab1.pyandlab2.pyGo on reading this notebook, and follow instuctions inside.
Let’s begin
You are going to program a simulator of bouncing clowns. To do so, we are going to load this module:
[2]:
import local
[3]:
local.gimme(5)
It was a 5 indeed
Download test data
Local file:
Global image

Local exercise image

Python tutor
[4]:
x = [1,2,3]
y = 6
jupman.pytut()
[4]:
Visualization provided by Python Tutor
[5]:
y = [1,2,3]
jupman.pytut()
[5]:
Visualization provided by Python Tutor
Start editing lab1.py in text editor
[6]:
from lab1_sol import *
add
Implement add function:
[7]:
add(3,5)
[7]:
8
sub
Implement sub function
[8]:
sub(7,4)
[8]:
3
[ ]: