IniziaInizia gratis

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.

Questo esercizio fa parte del corso

Introduction to NumPy

Visualizza il corso

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

# Create an array of zeros which has four columns and two rows
zero_array = ____
print(zero_array)
Modifica ed esegui il codice