Functions In Class Code Samples¶
This first code box is provided for your convenience: you can put any code in here and try things out.
For each of the following code samples, answer these questions:
- How many inputs (arguments) does this function take?
- What type of inputs (arguments) does this function expect?
- What does this function return?
- What will print out?
Multiple function calls in the same expression!
Local and global scope: BE CAREFUL.
return
ends the execution, even if there’s more code
Without a return
statement, the function returns None, when it runs out of code to execute (at the bottom of the function).
You have to do something with returned values, else they get discarded
Write a function definition that takes three numbers as inputs and returns the sum of all three