1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to NumPy

Connected

Exercise

Creating arrays from scratch

It can be helpful to know how to create quick NumPy arrays from scratch in order to test your code. For example, when you are doing math with large multi-dimensional arrays, it's nice to check whether the math works as expected on small test arrays before applying your code to the larger arrays. NumPy has many options for creating smaller synthetic arrays.

With this in mind, it's time for you to create some arrays from scratch! numpy is imported for you as np.

Instructions 1/2

undefined XP
  • 1
    • Create and print an array filled with zeros called zero_array, which has two rows and four columns.
  • 2
    • Create and print an array of random floats between 0 and 1 called random_array, which has three rows and six columns.