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

Project 7: Sparse Orders Matrix

Scientific Computing

Builds on these lessons

Current Task

Objective

A sparse matrix stores only its non-zero values, saving memory for matrices that are mostly zeros — like an orders grid where most items weren't ordered.

Task: convert a mostly-empty orders array into a sparse CSR matrix and print it.

index.py
from scipy.sparse import csr_matrix import numpy as np orders = np.array([[0, 0, 3], [0, 0, 0], [1, 0, 0]]) sparse_orders = csr_matrix(orders) print(sparse_orders)

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

Live Preview
🖼️

Verify your code to see the preview