This lesson will help you review Python functions by providing some challenge exercises involving control flow.
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 a number and checks to see if it is greater than ten would look like this
def greaterThanTen(number): if number > 10: return True else: return False
And this would produce output like:
>>> greaterThanTen(20) True >>> greaterThanTen(-10) False >>> greaterThanTen(10) False
When you’re ready to do this series of short function challenges, continue on to the rest of the lesson!