🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: NumPy: all 10 questions

Quiz: NumPy · Question 6 of 10

What does this print? (code)

What does this print?

import numpy as np
a = np.array([[1, 2], [3, 4], [5, 6]])
print(a.shape, a.sum(axis=0))
  1. A.(2, 3) [3 7 11]
  2. B.(3, 2) [ 9 12]
  3. C.(3, 2) [ 3 7 11]
  4. D.(3, 2) 21
Answer & explanation

Correct answer: (3, 2) [ 9 12]

3 rows and 2 columns; axis=0 adds down each column.

Can you get the rest right without peeking?

Take the timed Quiz: NumPy quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →