Python Reading

Key Ideas

In-Class Activity

Active Learning

Work through tutorial2.py and then do the following:

  1. Create a vector z with values ranging from 10 to 49
  2. Reverse Z
  3. Create a 3x3 matrix m with values ranging from 0 to 8
  4. Create a 3x3x3 array r with random values
  5. Create a 3x3 identity matrix
  6. Can you figure out what the following code produces without running it first?
    z = np.zeros((5,5))
    z += np.arange(5)
    print(z)