This lesson will help you review Python functions by providing some challenge exercises.
As a refresher, function syntax looks like this:
def some_function(some_input1, some_input2): … do something with the inputs … return output
For example, a function that takes in a number and returns that number multiplied by 4 would look like:
def mult_by_four(number): multiplied = number * 4 return multiplied
And this would produce output like:
>>> mult_by_four(10) 40 >>> mult_by_four(0) 0 >>> mult_by_four(-1) -4
When you’re ready to do this series of short function challenges, continue on to the rest of the lesson!