Solve the Price Puzzle
Advanced · Write the code · from NumPy Linear Algebra: Dot Products, Inverses, and Eigenvalues
From the lesson: NumPy Linear Algebra: Dot Products, Inverses, and Eigenvalues
Linear algebra is the math behind machine learning, computer graphics, physics simulations, and data science. Every time a game rotates a 3D object, a search engine ranks pages, or a neural network makes a prediction, matrix operations are doing the heavy lifting.
Read the lessonA store sells pens and notebooks. The prices are unknown.
Set up the coefficient matrix and the right-hand side vector, then use np.linalg.solve() to find the price of each item. Print the price of a pen and then the price of a notebook, each on a separate line, rounded to 2 decimal places.
import numpy as np
# Set up the system and solve
More NumPy Linear Algebra exercises
- Shopping Cart TotalAdvanced
- Matrix MultiplyAdvanced
- Predict the DeterminantAdvanced
- Find the EigenvaluesAdvanced
All Python exercises · 50 practice problems · Data Science & Machine Learning quiz