The program has to be coded in python. No imported libs. 4. Write only a Function. Write a function named MaxCol that ta

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

The program has to be coded in python. No imported libs. 4. Write only a Function. Write a function named MaxCol that ta

Post by answerhappygod »

The program has to be coded in python. No imported libs.
4. Write only a Function. Write a function named MaxCol 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 column has the maximum
sum and return the column
number (starting with 0 just like indexing lists) and the maximum
sum as a list. In the example above,
column 0 has a sum of 12, column 1 has a sum of 15, and column 2
has a sum of 18. The function
MaxCol would return [2, 18] in this case, where 2 is the col number
and 18 is the sum of col 2.
Example:
The function receives
[[10, 5.5], [3.1, -2.7], [2.8, 6.4]]
The function should return [0, 15.9] where 0 is the column number
and 15.9 is the sum of column 0.
You can build your own tests to test your function but please
comment them out when you submit your
file for this problem.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply