Week 2 • Monday

Block 12: Array Creation Helpers & Shapes

Use factory functions to create arrays of any shape quickly.

Concepts

Code Examples

See exercise below.

Exercise

Create a 3×4 matrix of zeros, print shape, then reshape to 2×6. Create an array of 10 evenly spaced values between 0 and 1 using linspace.

Homework

Write a 'multiplication table' as a 10×10 NumPy array using np.arange and reshape. Tuesday