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)