Perfect! Another interesting concept related to functions is
None. It is a value you may return when you mean "nothing". For instance:
def safe_division(x, y):
if y == 0:
The function above takes two numbers and divides the first one by the second one... unless the second number is 0! Division by 0 is not allowed, so we would normally end up with an error. Our function, however, returns a
None value instead to signify that the operation is not possible.
As you saw earlier in this part,
None is also returned when the programmer does not provide a
return statement at all.
Note that in most other languages, the
null keyword is used instead of