z = 1
print(z)
z = z + 1
9
def sillystring():
return """
Hello world!
"""
print(sillystring())
help(sillystring)
Hello world!
Help on function sillystring in module __main__:
sillystring()
import math
def hypotenuse(a, b):
"""
Return the hypotenuse of a right triangle with side lengths a and b.
"""
return math.sqrt(a**2 + b**2)
print(hypotenuse(3, 4))
print(3+2)
5.0 5
print(float(42))
print(int(41.999))
print(round(41.999))
print(round(41.5))
42.0 41 42 42
import math
def hypotenuse(a: float, b: float) -> str:
"""
Return the hypotenuse of a right triangle with side lengths a and b.
"""
return math.sqrt(a**2 + b**2)
hypotenuse(3, 4)
<cell>7: error: Incompatible return value type (got "float", expected "str") [return-value]
5.0
!wget https://student.cs.uwaterloo.ca/~cs114/src/Assignment-00.ipynb
--2026-01-13 15:05:38-- https://student.cs.uwaterloo.ca/~cs114/src/Assignment-00.ipynb Resolving student.cs.uwaterloo.ca (student.cs.uwaterloo.ca)... 129.97.167.168 Connecting to student.cs.uwaterloo.ca (student.cs.uwaterloo.ca)|129.97.167.168|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 5968 (5.8K) Saving to: ‘Assignment-00.ipynb’ Assignment-00.ipynb 100%[===================>] 5.83K --.-KB/s in 0s 2026-01-13 15:05:38 (4.48 GB/s) - ‘Assignment-00.ipynb’ saved [5968/5968]
print(42)/(7)
print("Hello")
<cell>1: error: Unsupported operand types for / ("None" and "int") [operator]
42
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) Input In [5], in <cell line: 1>() ----> 1 print(42)/(7) 2 print("Hello") TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'
print(42/7
def hello():
print("World")
Input In [7] print(42/7 ^ SyntaxError: '(' was never closed
print(42/7
Input In [8] print(42/7 ^ SyntaxError: incomplete input
def return():
return 42
Input In [9] def return(): ^ SyntaxError: invalid syntax
def curious():
return sqrt(9)
curious()
--------------------------------------------------------------------------- NameError Traceback (most recent call last) Input In [13], in <cell line: 3>() 1 def curious(): 2 return sqrt(9) ----> 3 curious() Input In [13], in curious() 1 def curious(): ----> 2 return sqrt(9) NameError: name 'sqrt' is not defined
def weird(x):
x = x * 5
return x
File <tokenize>:3 return x ^ IndentationError: unindent does not match any outer indentation level
assert 1 == 0, "Math is broken"
--------------------------------------------------------------------------- AssertionError Traceback (most recent call last) Input In [17], in <cell line: 1>() ----> 1 assert 1 == 0, "Math is broken" AssertionError: Math is broken
print(0.3-0.2)
assert 0.3-0.2 == 0.1, "Math too simple to fail"
0.09999999999999998
--------------------------------------------------------------------------- AssertionError Traceback (most recent call last) Input In [19], in <cell line: 2>() 1 print(0.3-0.2) ----> 2 assert 0.3-0.2 == 0.1, "Math too simple to fail" AssertionError: Math too simple to fail