ΣνΜDr. Sharon's Math PlatformSyvara Learning
Question Bank › 📘 Undergraduate › Programming for Engineers › Q4

Q4 · NumPy: array shapes, np.arange vs np.linspace

NumPy Arrays and Matrix Operations 🟢 Intro Coding
Question

Using NumPy:

(a) Create the 1D array [1, 4, 3] and the 2D array [[1, 4, 3], [9, 2, 7]]. Print the .shape of each.
(b) Use np.arange to create: [0.5, 1.0, 1.5, 2.0, 2.5]
(c) Use np.linspace to create 10 evenly spaced values between 3 and 9 (inclusive).

What is the key difference between np.arange and np.linspace?

🔒

Log in to see the worked solution

This is one of the free solutions in Programming for Engineers. Enter your email to get started. Your first free solutions in every course unlock as soon as you verify.

Log in or sign up with email
← Previous Next →
Working…