Solve in python Q3: Filter a list (20 marks) Suppose you are given a list of marks,
Fantastic news! We've Found the answer you've been seeking!
Question:
Solve in python
Transcribed Image Text:
Q3: Filter a list (20 marks) Suppose you are given a list of marks, please write a function filter_mark(marks, grade) that takes a list of marks as input and return a list contianing only the marks of the specified grade. For example, filter_mark ([30, 20, 60, 78], 'F') should return [30, 20]. Because only 30 and 20 are F grades. def filter_mark (li, grade): # INSERT YOUR CODE BELOW #**** #EXAMPLE TESTING CASES # DO NOT CHANGE filter_mark([10, 20, 30, 40], 'F') # return [10, 20, 30, 40] filter_mark ([33, 28, 89, 85, 50], "HD') # return [89, 85] wwwww Q3: Filter a list (20 marks) Suppose you are given a list of marks, please write a function filter_mark(marks, grade) that takes a list of marks as input and return a list contianing only the marks of the specified grade. For example, filter_mark ([30, 20, 60, 78], 'F') should return [30, 20]. Because only 30 and 20 are F grades. def filter_mark (li, grade): # INSERT YOUR CODE BELOW #**** #EXAMPLE TESTING CASES # DO NOT CHANGE filter_mark([10, 20, 30, 40], 'F') # return [10, 20, 30, 40] filter_mark ([33, 28, 89, 85, 50], "HD') # return [89, 85] wwwww
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
Solve using Python spyder. The airline_delay on the right is just a snapshot of the file. explain in steps. Origin Airport: LGA STEP 1 Flights from LGA was on time 5033 times. Flights from LGA was...
-
Solve using lisp program not python or java. ( lisp emacs ) Write a function called filter-seq that takes a sequences (a string) and an alphabet a (a string), and generates a result sequence (a...
-
Use Python to solve t 1. First generate at least 11 vectors of unit length that radiate out from the origin spaced equal angles apart (think of this as each vector pointing to one of the numbers on a...
-
Write a method to take an integer array as a parameter and return how many elements having the same digits in each element in the array for example if we have array 1 1 , 4 4 , 1 4 , 2 3 , 1 2 , 5 6...
-
Evergreen Nursery and Landscape has two profit centers: Nursery and Landscape. Nursery buys young evergreen trees, grows them for a year, and then sells them to Landscape. Landscape then sells and...
-
The roller in the Fig. 12.1 6 consists of two mutually integral (i.e., welded) disks of the same material and density. The roller can rotate without friction around a fixed pivot coincident with the...
-
George Oppenheimer, an agent for Wellington Farms of Massachusetts, Inc., had contacted Mark Kiriakou from the Capital Area Food Bank regarding an order for frozen turkey meat. In an exchange of...
-
Dallas Industries has adopted the following production budget for the first 4 months of 2014. Each unit requires 2 pounds of raw materials costing $2 per pound. On December 31, 2013, the ending raw...
-
1) Write a Python function to convert mass values from gram to ounce and return the conversion result. The conversion formula is ounce = gram x 0.035274. The function header is: def gm_to_ounce...
-
The Royal Seas Company runs a three-night cruise to the Caribbean from Port Canaveral. The company wants to run TV ads promoting its cruises to high-income men, high-income women, and retirees. The...
-
a) Write an Assembly Language program to transfer 10 bytes of data from one memory location to another. Also, draw the flowchart for the same. b) Write the appropriate 8086 instructions to perform...
-
How long do you think you could survive in your current home if a mandatory shelter- in-place order was issued and there was no running water? What supplies would you need to survive for 72 hours? A...
-
Hartwell Corporations bonds have a 20-year maturity, an 8% semiannual coupon, and a face value of $1,000. The going nominal annual interest rate (rd) is 7%. What is the bonds price?
-
Below is a representation of 50 atoms of a fictitious element called pearsonium (Ps). The red spheres represent Ps-296, the blue spheres Ps-297, and the green spheres Ps-298. a. Assuming that the...
-
A common isotope used in medical imaging is technetium- 99m, which emits gamma rays. A sample initially containing 0.500 mg of technetium-99m is monitored as a function of time. Based on its rate of...
-
Ask your class for opinions on the use of Alexa-style always-on microphones. What is the breakdown of people who are so concerned that they will never use these products versus those who are...
-
The beginning balance of petty cash each month is $100. Today, November 30, 20X5, you have $45.15 left in your petty cash. A check is written from your checking for the amount you need to be able to...
-
Convert the numeral to a HinduArabic numeral. A94 12
-
A periodic signal x(t), of fundamental frequency Ω 0 = Ï, has a period The signal x(t) is the input of an ideal low-pass filter with the frequency response H(jΩ) shown in...
-
Consider the following problems for LTI discrete-time systems. (a) The input and the output of a LTI discrete-time system are Find the transfer function H(z). (b) The transfer function of an LTI...
-
The following problems relate to the modulation property of the Fourier transform: (a) Consider the signal x(t) = p(t) + p(t) cos(Ï t) where p(t) = u(t + 1) u(t 1) i. Use the modulation property...
-
Novo Nordisk is a Denmark-based biopharmaceutical company with a focus on diabetes drugs. The company provides detailed disclosure of revenue along geographic, business segment, and product lines....
-
Use the data in Example 1 on Novo Nordisk to answer the following questions: i. Xiaoping Wu is an equity analyst covering European pharmaceutical companies for his clients in China. Wu projects that...
-
Walgreens and Rite Aid are two of the largest retail drugstore chains in the United States. For both companies, around two-thirds of their sales are from prescription pharmaceuticals, with the...
Study smarter with the SolutionInn App