Write a Python function that multiplies a matrix by a scalar and returns the result.
Examples
Example 1:
Input:
matrix = [[1, 2], [3, 4]], scalar = 2Output:
[[2, 4], [6, 8]]Explanation: Each element of the matrix is multiplied by the scalar.
Starter Code
def scalar_multiply(matrix: list[list[int|float]], scalar: int|float) -> list[list[int|float]]:
return resultPython3
ReadyLines: 1Characters: 0
Ready