Question: Write a function contains_all_zero_col (table) that returns True if a given input table contains one column with all elements equal to 0; and otherwise

Write a function contains_all_zero_col (table) that returns True if a given input table contains one column Write a function sublist_of_sum (lst, x), that returns the first sublist of 1st that sums exactly to x. 

Write a function contains_all_zero_col (table) that returns True if a given input table contains one column with all elements equal to 0; and otherwise returns False. Input: table table with numeric elements Output: True if one column in table has all elements equal to 0; otherwise False For example: >>> table = [[0, 0, 1], - [-2, 0, 3], [1, 0, -4]] >>> contains_all_zero_col (table) True : >>> table = [[0.0, 0.0, 1.0], [0.5, -1.0, 2.0], [0.0, 4.0, 5.3]] >>> contains_all_zero_col (table) False - Write a function sublist_of_sum (lst, x), that returns the first sublist of 1st that sums exactly to x. Otherwise, it should return None if no such sublist exists. Function header: sublist of sum (1st, x) Input: a list 1st with numeric elements and a number x. Output: the first (left-most) sublist that sums exactly to x or None if no such sublist exists. Examples: >>> sublist_of_sum ([ 1, 8, 5, 10], 9) [1, 8] >>> sublist_of_sum ([ -5, -2, 4, 11], 15) [4, 11] >>> sublist_of_sum ([3, 7, 2, 3], 12) [3, 7, 2] >>> sublist_of_sum ([5, 9, -1, 2], 9) [9] >>> sublist_of_sum ([5, 9, -1, 2], 7) None

Step by Step Solution

3.49 Rating (149 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

1 def containsallzerocoltable rowslentable number of rows are the number of element... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!