Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Heres a Python program that includes the valuesBefore function according to the requiremen...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