Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a Python function scale that takes two arguments. The first must be a number, the second can be either int, float, Vector, or Matrix.
Write a Python function scale that takes two arguments. The first must be a number, the second can be either int, float, Vector, or Matrix. It returns a new object of the same type as the second argument that is the scaling of the second argument
Example:
>>> scale(2, 3)
6
>>> scale(2, 3.14)
6.28
>>> scale(2, Vector([4,5]))
Vector(data=[8, 10])
>>> scale(2, Matrix(2,3,[1,3,2,7,5,8]))
Matrix(rows=2, cols=3, data=[2, 6, 4, 14, 10, 16])
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started