Write a function called find value that takes a list of lists and a value as...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a function called find value that takes a list of lists and a value as arguments and returns a list giving the indices of the (sub)list and position in that list where the first instance of the value was found. If the value does not exist in any of the (sub)lists, the function returns [-1, -1]. For example, given: my_list = [[2, 5], [1, 3, 4], [4], [7, 3]] the call: find_value(my_list, 4) would return: [1, 2] and the call: find_value(my_list, 7) would return: [3, 0] and the call: find_value(my_list, 8) would return: [-1, -1] def find_value(lst, val): Problem - 6: Write a function sum_without_twenties(a, b, c) that returns the sum of three int arguments a, b, and c. However, do not include any int as part of the sum if it is within the range [20, 29] (inclusive). Problem -7: Write a function debug () that takes in two sets, and makes a new set that contains the elements both sets have in common. If "bug" is one of the elements, remove that from the new set. Return the new set. For example, debug ({"bug", "rice", "apple"}, {"rice", "bug", "sugar"}) should evaluate to {'rice'). Note: You may be asked to demonstrate the working code of any problem. Write a function called find value that takes a list of lists and a value as arguments and returns a list giving the indices of the (sub)list and position in that list where the first instance of the value was found. If the value does not exist in any of the (sub)lists, the function returns [-1, -1]. For example, given: my_list = [[2, 5], [1, 3, 4], [4], [7, 3]] the call: find_value(my_list, 4) would return: [1, 2] and the call: find_value(my_list, 7) would return: [3, 0] and the call: find_value(my_list, 8) would return: [-1, -1] def find_value(lst, val): Problem - 6: Write a function sum_without_twenties(a, b, c) that returns the sum of three int arguments a, b, and c. However, do not include any int as part of the sum if it is within the range [20, 29] (inclusive). Problem -7: Write a function debug () that takes in two sets, and makes a new set that contains the elements both sets have in common. If "bug" is one of the elements, remove that from the new set. Return the new set. For example, debug ({"bug", "rice", "apple"}, {"rice", "bug", "sugar"}) should evaluate to {'rice'). Note: You may be asked to demonstrate the working code of any problem.
Expert Answer:
Related Book For
Digital Design and Computer Architecture
ISBN: 978-0123944245
2nd edition
Authors: David Harris, Sarah Harris
Posted Date:
Students also viewed these programming questions
-
Q1. You have identified a market opportunity for home media players that would cater for older members of the population. Many older people have difficulty in understanding the operating principles...
-
CANMNMM January of this year. (a) Each item will be held in a record. Describe all the data structures that must refer to these records to implement the required functionality. Describe all the...
-
X H H H HCZO HONH HO HN. HOC H A variety of electrophiles (EY) will react with benzene, and derivatives of benzene, to yield substitution products. Halogenation of OH benzene rings is an reaction...
-
Determine the force in members BD and CD of the truss shown. 36 kips 36 kips 7.5 ft 4 panels at 10 ft-40 ft
-
Rebecca visits the specialty grocery store in search of some fresh organic apples for her recipes that will give her as much utility as possible, given her $100/ month grocery budget. During the...
-
The decomposition of the sums of squares into a contribution due to error and a contribution due to regression underlies the least squares analysis. Consider the identity...
-
Develop a worksheet simulation for the following problem. The management of Madeira Manufacturing Company is considering the introduction of a new product. The fixed cost to begin the production of...
-
Part I Your financial statement analysis suggests that Tech Firm A (TFA) has been engaging in accruals earnings management to boost its earnings. Based on this analysis, you decide to short TFA...
-
Parson Company acquired an 80 percent interest in Syber Company on January 1, 2020. Any portion of Sybers business fair value in excess of its corresponding book value was assigned to trademarks....
-
The Perfect House company produces two types of bathtub, the Hydro Deluxe model and the Singing Bird model. The company noticed that demand and prices are related. In particular. for Hydro Deluxe:...
-
The GROUP BY operator in SQL is used to a. aggregate functions on the query results based on one or more columns. b. identify which columns are used to sort the resulting data. c. state the criteria...
-
What is the speedup of going from a 1-issue processor to a 2-issue processor from Figure 4.69? Use your code from 4.28.1 for both 1-issue and 2-issue, and assume that 1,000,000 iterations of the loop...
-
Showa Shell Sekiyu K.K. is the 50 percent owned Japanese subsidiary of the oil giant Royal Dutch Shell. Unlike giant multinationals such as Exxon or Royal Dutch Shell that are vertically integrated...
-
The FROM clause to the SELECT statement used in SQL indicates a. the name of the table(s) from which to retrieve data. b. the name of the column(s) from which to retrieve data. c. the name of the...
-
A class in a relational database model is defined as a. the sum of a whole. b. characteristics or properties of a table. c. person, place, thing, transaction, or event about which information is...
-
Your organization has implemented a robust ERM program similar to the one outlined in this chapter. The audit committee has asked you to assess the design adequacy and operating effectiveness of the...
-
In Problems 718, write the augmented matrix of the given system of equations. f0.01x0.03y = 0.06 [0.13x + 0.10y = 0.20
-
Repeat Exercise 2.7 using only NOT gates and NAND and NOR gates.
-
Express the base 10 numbers in Exercise 5.25 in 16-bit fixed-point twos complement format with eight integer bits and eight fraction bits. Express your answer in hexadecimal. Data from Problem 25 (a)...
-
Convert the following decimal numbers to 6-bit twos complement binary numbers and subtract them. Indicate whether or not the difference overflows a 6-bit result. (a) 18 10 12 10 (b) 30 10 9 10 (c)...
-
Explain how the financial manager might use industry norms in the design of the companys financing mix.
-
You have developed the following income statement for Sing-Tel Corporation. It represents the most recent years operations, which ended yesterday. Your supervisor in the controllers office has just...
-
Footwear, Inc. manufactures a complete line of mens and womens formal shoes for independent merchants. The average selling price of its finished product is \($85\) per pair. The variable cost for...
Study smarter with the SolutionInn App