9.7. This is a notebook example#
9.7.1. First python code running in a notebook#
This specific cell contains a comment and describes the following code, which implements the Pythagoras theorem
from math import sqrt
a = 3.
b = 4.
print ('testing the Pythagoras theorem: ', sqrt (a**2 + b**2) )
testing the Pythagoras theorem: 5.0
9.7.2. Definition of a function within a notebook#
def Pythagoras (a, b):
return sqrt (a**2 + b**2)
print ('testing the Pythagoras theorem function: ', Pythagoras (a, b) )
testing the Pythagoras theorem function: 5.0