🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Exercises.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.

Project 5: Array Dimension Explorer

Data Engineer

Builds on these lessons

Current Task

Objective

Arrays can have any number of dimensions: a bare scalar is 0-D, a list is 1-D, a list of lists is 2-D, and so on.

Task: create a 0-D, 1-D, 2-D, and 3-D array, then print each one's .ndim.

index.py
import numpy as np zero_d = np.array(42) one_d = np.array([1, 2, 3]) two_d = np.array([[1, 2], [3, 4]]) three_d = np.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]]]) print(zero_d.ndim, one_d.ndim, two_d.ndim, three_d.ndim)

* Hint: Correct characters turn green, incorrect ones turn red.

Live Preview
🖼️

Verify your code to see the preview