The program has to be coded in python. No imported libs. 3. Write only a Function. Write a function named MaxRow that ta
Posted: Fri Apr 29, 2022 6:50 am
The program has to be coded in python. No imported libs.
3. Write only a Function. Write a function named MaxRow that
takes a nested list of data that
represents a matrix. An example parameter taken by this function
could be [[1, 2, 3],[4, 5, 6],[7, 8, 9]].
This represents the matrix
1 2 3
4 5 6
7 8 9
The function should be able to handle any sized matrix it is
given and the data in the matrix can be of
type float. The function should return which row has the maximum
sum and return the row number
(starting with 0 just like indexing lists) and the maximum sum as a
list. In the example above, row 0 has
a sum of 6, row 1 has a sum of 15, and row 2 has a sum of 24. The
function MaxRow would return
[2, 24] in this case, where 2 is the row number and 24 is the sum
of row 2.
Example:
The function receives
[[10, 5.5], [3.1, -2.7], [2.8, 6.4]]
The function should return the [0, 15.5], where 0 is the row number
and 15.5 is the sum of row 0.
You can build your own tests to test your function but please
comment them out when you submit your
file for this problem.
3. Write only a Function. Write a function named MaxRow that
takes a nested list of data that
represents a matrix. An example parameter taken by this function
could be [[1, 2, 3],[4, 5, 6],[7, 8, 9]].
This represents the matrix
1 2 3
4 5 6
7 8 9
The function should be able to handle any sized matrix it is
given and the data in the matrix can be of
type float. The function should return which row has the maximum
sum and return the row number
(starting with 0 just like indexing lists) and the maximum sum as a
list. In the example above, row 0 has
a sum of 6, row 1 has a sum of 15, and row 2 has a sum of 24. The
function MaxRow would return
[2, 24] in this case, where 2 is the row number and 24 is the sum
of row 2.
Example:
The function receives
[[10, 5.5], [3.1, -2.7], [2.8, 6.4]]
The function should return the [0, 15.5], where 0 is the row number
and 15.5 is the sum of row 0.
You can build your own tests to test your function but please
comment them out when you submit your
file for this problem.