Question: a. Write a function valuesBefore() that takes a two-dimensional list of integers and an int search value as parameters. The function should search each

a. Write a function valuesBefore() that takes a two-dimensional list of integers and an int search value as

a. Write a function valuesBefore() that takes a two-dimensional list of integers and an int search value as parameters. The function should search each column in the two-dimensional list and count the number of values that come before the first occurrence of the search value in each column. If the search value is not found in a column, the count should be -1. Store the counts in a one-dimensional list. The function should return the array which stores the counts. For example, if two D array is as follows: 48 6 6225 779 6 2 3 89 38 26845 searchValue = 8 the function will return: 2 -1 04 b. Write a program to initialize a two-dimensional list with integers and call the above function by passing the list and an integer value and display the result as shown in the sample run. Sample Run: Enter the number to search: There are 2 values before 8 in column There is no 8 in column 1 There are 0 values before 3 in column 2 There are 4 values before 9 in column 3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres a Python program that includes the valuesBefore function according to the requiremen... 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!