Chapter 12

MATLAB Code Examples

 

Python Code Examples

Exercises

  1. Write a function that calculates the factorial for the input value..
  2. Write a function that calculates the factorial for each value of an input vector, and returns a vector of results.
  3. Write a function that takes an input matrix, and calculates the average value of each row (or – if instructed by an optional argument – the average value of each column) and returns a vector containing the results
  4. Package your functions from these exercises into a custom Python module.