a. Write a function valuesBefore() that takes a two-dimensional list of integers and an int search...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 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
Expert Answer:
Answer rating: 100% (QA)
Heres a Python program that includes the valuesBefore function according to the requiremen... View the full answer
Related Book For
Numerical Methods With Chemical Engineering Applications
ISBN: 9781107135116
1st Edition
Authors: Kevin D. Dorfman, Prodromos Daoutidis
Posted Date:
Students also viewed these programming questions
-
To illustrate the effects of driving under the inuence (DUI) of alcohol, a police ofcer brought a DUI simulator to a local high school. Student reaction time in an emergency was measured with...
-
This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of an array of objects as a class data...
-
At Blossom Company, events and transactions during 2020 included the following. The tax rate for all items is 20%. (1) Depreciation for 2018 was found to be understated by $148000. (2) A strike by...
-
Nadal Corporation purchased 10,000 shares of Cutler Inc.'s common stock, on January 1, 2019, for $100,000. During 2019, Cutler declared and paid cash dividends to Nadal in the amount of $8,000....
-
Stone Sour Corp. issued 20-year bonds two years ago at a coupon rate of 7.1 percent. The bonds make semiannual payments. If these bonds currently sell for 105 percent of par value, what is the YTM?
-
Ronda Rousey Fight Times Perhaps the most popular fighter since the turn of the decade, Ronda Rousey is famous for defeating her opponents quickly. The five number summary for the times of her first...
-
At the end of June, Morton Company had a balance of $49,900 in the vacation benefits payable account. During July, employees earned an additional $3,110 in vacation benefits, but some employees used...
-
Presented below is information related to Sunbuck's Coffee Club for its fiscal year ending April 30, 2023. During the year, the Board of Directors decided to discontinue the operations of its entire...
-
Which series has the highest beta. BraveNewCoin Liquid Index for Bitcoin 1D BNC Trading Brave Ne Yellow Green Blue Orange
-
Woolard Supplies (a sole-proprietorship) has taxable income in 2018 of $240,000 before any depreciation deductions (179, bonus, or MACRS) and placed some office furniture into service during the...
-
In a group of five items, two are defective. Find the distribution of N, the number of draws we need to find the first defective item. Find the mean and variance of N.
-
Explain what M&M Propositions One and Two have in common and how they are different.
-
What was unusual about U.S. fiscal policy from 1980 to 1995?
-
It is possible to separate whole milk into two productsskim milk and cream. Apply Proposition One thinking to the question of whether separating whole milk into two products can fundamentally create...
-
What is meant by the terms levered and unlevered equity? Suppose an investor in Paypal Holdings, an unlevered firm, wanted the company to borrow more. What could they do that would be equivalent to...
-
You will need to submit a budget report to the CEO, including an explanation of the utility of master budgets. You will also submit a variance report that shows how the company is performing versus...
-
Write a function that reads a Float24_t value: Float24_t float24_read(void) A legitimate float24 value string is of the form: "mantissabexponent" where the mantissa (m) and the exponent (e) may have...
-
Use the built-in MATLAB solver to find the solution to 2 4 X1 BAGHA TH 4 1 2 2 -2 -3 X3 1 3 -2 (2.15.1)
-
Derive the fourth-order finite difference 4 f.
-
Use Picards method to find the roots of for the initial guesses 0.1, 0.6, 1.99, and 2.01. f(x)=x-3x+2=0 (3.3.2)
-
Explain the significance of \(g_{c}\) in Newton's second law. What are the magnitude and units of \(g_{c}\) in the English Engineering system? In the SI system?
-
Explain the difference between absolute and gage pressures.
-
Nitrogen gas is reversibly compressed from \(70^{\circ} \mathrm{F}\) and 14.7 psia to one-fourth of its original volume by (1) a \(T=\) const process or (2) a \(p=\) const process followed by a...
Study smarter with the SolutionInn App