Browse and solve 1,200+ machine learning coding challenges on Deep-ML. Filter by difficulty (beginner, intermediate, advanced) and category (linear algebra, machine learning, deep learning, NLP, computer vision). Write Python solutions in the browser and get instant feedback against test cases.
Deep-ML | Scalar Multiplication of a MatrixScalar Multiplication of a Matrix
Scalar Multiplication of a Matrix
EasyLinear Algebra
Write a Python function that multiplies a matrix by a scalar and returns the result.
Example:
Input:
matrix = [[1, 2], [3, 4]], scalar = 2
Output:
[[2, 4], [6, 8]]
Reasoning:
Each element of the matrix is multiplied by the scalar.