In [1]:
assert True, "This is an assert statement"
In [2]:
num = 2.003
In [3]:
assert num > 2, "value must be > 2"
In [4]:
assert num < 2.001, "value can not be a bit bigger than 2"
In [7]:
def temp_c_to_k(temp_in_c):
""" convert temperature from C to K
"""
assert temp_in_k < 0, "K must be positive"
temp_in_k = temp_in_c + 273.15
return temp_in_k
In [10]:
print(temp_c_to_k(-100000000))
In [ ]: