Assignment
These exercises cover basic use of functions. Remember that functions
are defined by a def
statement, accept inputs via
arguments, and have somewhere inside their definition a return
statement that returns the output.
- Write a function that returns the factorial of a number.
- Write a function that checks whether or not a vector of numbers is monotonically increasing (i.e. each subsequent element is greater than the one previous). It should return 1 if true and 0 if false.
Solution
See the following web page.