Complete the function blood_donor, which determines whether a person is able to donate blood. A person...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Complete the function blood_donor, which determines whether a person is able to donate blood. A person is eligible to donate blood if his/her age is 18 or over and his/her mass ("weight") is greater than 48 kilograms. The function takes four arguments: • age, which gives the prospective donor's age mass, which gives the prospective donor's mass in kilograms requested_blood_type, which gives the requested blood type donor_blood_type, which gives the prospective donor's blood type The function returns one of several strings, depending on the inputs. If the donor's eligibility is satisfied and his/her blood type matches the requested blood type, return 'match'. Otherwise, check for ineligibility in the following order and return the first reason for ineligibility, if any: 'too young, too light' (both the age and the mass are too low) 'too young' (age is too low) 'too light' (mass is too low) "mismatch' (requested_blood_type and donor_blood_type don't match) Examples: Function Call blood donor (21, 50, 'A' blood donor (16, 50, blood donor (20, 48, blood donor (17, 47, blood donor (21, 70, Return value natch too young too light too young, too light nismatch Activate [ ]] 1 def blood donor (age, mass, requested_blood_type, donor_blood_type): 2 return 'Error" # DELETE THIS LINE and start coding here. # Remember: end all of your functions with a return statement, not a print statement! 4 5 6 # Test cases 7 print (blood_donor (21, 50, 'A', 'A')) 8 print (blood donor (16, 50, 'A', 'B')) 'A')) 9 print (blood_donor (20, 48, '0', 10 print (blood_donor (17, 47, 'B', 'B')) 11 print (blood_donor (21, 70, 'A', 'B')) - Part 2: Buying in Bulk (10 points) Customers can buy computer screens in bulk from Computer Monitor Paradise, Inc. Customers receive discounts based on the number of monitors they buy. Complete the function bulk purchase, which takes two arguments: monitors_to_buy, which is the number of computer monitors a customer wants to purchase; and monitor_cost, which is the non-discounted cost to buy a single monitor. The function computes and returns the total cost for the purchase according to the following rules: of Monitors Cost in $ 1-99 100-199 200+ Examples: monitor cost per monitor monitor_cont for each of the first 100 monitors and 20% discount on the rest 20% discount on the first 200 monitors and 35% discount on the rest Function Call bulk purchase(80, 75) bulk purchase (175, 120) bulk purchase (228, 180) Expected Output $6000.00 $19200.00 $32076.00 Activate Wi Go to Settings Complete the function blood_donor, which determines whether a person is able to donate blood. A person is eligible to donate blood if his/her age is 18 or over and his/her mass ("weight") is greater than 48 kilograms. The function takes four arguments: • age, which gives the prospective donor's age mass, which gives the prospective donor's mass in kilograms requested_blood_type, which gives the requested blood type donor_blood_type, which gives the prospective donor's blood type The function returns one of several strings, depending on the inputs. If the donor's eligibility is satisfied and his/her blood type matches the requested blood type, return 'match'. Otherwise, check for ineligibility in the following order and return the first reason for ineligibility, if any: 'too young, too light' (both the age and the mass are too low) 'too young' (age is too low) 'too light' (mass is too low) "mismatch' (requested_blood_type and donor_blood_type don't match) Examples: Function Call blood donor (21, 50, 'A' blood donor (16, 50, blood donor (20, 48, blood donor (17, 47, blood donor (21, 70, Return value natch too young too light too young, too light nismatch Activate [ ]] 1 def blood donor (age, mass, requested_blood_type, donor_blood_type): 2 return 'Error" # DELETE THIS LINE and start coding here. # Remember: end all of your functions with a return statement, not a print statement! 4 5 6 # Test cases 7 print (blood_donor (21, 50, 'A', 'A')) 8 print (blood donor (16, 50, 'A', 'B')) 'A')) 9 print (blood_donor (20, 48, '0', 10 print (blood_donor (17, 47, 'B', 'B')) 11 print (blood_donor (21, 70, 'A', 'B')) - Part 2: Buying in Bulk (10 points) Customers can buy computer screens in bulk from Computer Monitor Paradise, Inc. Customers receive discounts based on the number of monitors they buy. Complete the function bulk purchase, which takes two arguments: monitors_to_buy, which is the number of computer monitors a customer wants to purchase; and monitor_cost, which is the non-discounted cost to buy a single monitor. The function computes and returns the total cost for the purchase according to the following rules: of Monitors Cost in $ 1-99 100-199 200+ Examples: monitor cost per monitor monitor_cont for each of the first 100 monitors and 20% discount on the rest 20% discount on the first 200 monitors and 35% discount on the rest Function Call bulk purchase(80, 75) bulk purchase (175, 120) bulk purchase (228, 180) Expected Output $6000.00 $19200.00 $32076.00 Activate Wi Go to Settings
Expert Answer:
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
The letters of the word HAT are cut apart and put into a bag. One letter is drawn from the bag and a standard die is rolled. What is the probability of drawing the letter A and rolling a number that...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Whether Mary is an employee or an independent contractor of Drake Education Solutions (DES). Rule: The relevant rule is the Australian Fair Work Act 2009 (FW Act). The FW Act sets out the factors...
-
Technology guru Tim O'Reilly said this about the publishing industry: " To adapt, publishers need to cannibalize their own business, experimenting with new forms, new formats, and new business...
-
Is there a preferred habitat for banks? credit unions? property insurance companies? life insurance companies?
-
For each of the time series of Exercise 21.16, use the DF test to find out if these series contain a unit root. If a unit root exists, how would you characterize such a time series?
-
There shall be no flow of water from a centrifugal pump until the pressure rise in the impeller is greater than the (a) suction head (b) delivery head (c) static head (d) manometric head
-
Journal entries for prepaid rent ABB Group (ABB), headquartered in Switzerland, is one of the worlds largest engineering companies. ABB applies U.S. GAAP, and reports its results in millions of U.S,...
-
What are the challenges and strategies for implementing TPM in highly regulated industries, such as pharmaceuticals or aerospace? How can TPM contribute to compliance and quality assurance in these...
-
Pulsar Optics produces medical lasers for use in hospitals. The accounts and their balances appear in the ledger of Pulsar Optics on April 30 of the current year as follows: Preferred 1% Stock, $120...
-
An Australian a company (Pty Ltd) has the following expenses. Advertising $8,000, Purchases of trading stock $90,000 Stock on hand at the beginning of the year was $11,000; at the end of year...
-
In question 32, what is the probability that there are no traffic accidents in all five workdays of a week? Question 32 The state highway bureau found that during the rush hour, in the treacherous...
-
An analyst calculates the probability of McGregor stock going up in value for any month as .6 and the probability of the same stock going down in any month as .4. Calculate the probability that the...
-
During each hour, 0.1 % of the total production of paperclips is defective. For a random sample of 500 pieces of the product, what is the chance of finding more than one defective item?
-
After assembly, a finished TV is left turned on for one full day (24 h) to determine whether the product is reliable. On average, two TVs break down each day. Yesterday 500 TVs were produced. What is...
-
A medical report shows that 5% of stock brokers suffer stress and need medical attention. There are 10 brokers working for your brokerage house. What is the probability that three of them will need...
-
On October 1, 2021, Adoll Company acquired 2,600 shares of its $1 par value stock for $38 per share and held these shares in treasury. On March 1, 2023, Adoll resold all the treasury shares for $34...
-
You've been asked to take over leadership of a group of paralegals that once had a reputation for being a tight-knit, supportive team, but you quickly figure out that this team is in danger of...
-
Bill and Guilda each own 50 percent of the stock of Radiata Corporation, an S corporation. Guilda's basis in her stock is $25,000. On July 31, 2012, Bill sells his stock, with a basis of $40,000, to...
-
Diego, age 28, married Dolores, age 27, in 2012. Their salaries for the year amounted to $46,479 and they had interest income of $3,500. Diego and Dolores' deductions for adjusted gross income...
-
Olive Corporation was formed and began operations on January 1, 2012. The corporation's income statement for the year and the balance sheet at year-end are presented below. The corporation made...
-
Presented below is selected information related to Tsui Repairs at December 31, 2025. Tsui reports financial information monthly (amounts in thousands). a. Determine the total assets of Tsui Repairs...
-
Explain the career opportunities in accounting.
-
Collins Computer Timeshare entered into the following transactions during May 2025. 1. Purchased computers for R\($20,000\) from Digital Equipment on account. 2. Paid R\($4,000\) cash for May rent on...
Study smarter with the SolutionInn App