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...
-
A psychologist studying the effects of nutrition on the behavior of laboratory rats is feeding one group a combination of three foods: I, II, and III. Each of these foods contains three additives, A,...
-
The time between arrivals of cars at the Petroco Service Station is defined by the following probability distribution: Time Between Arrivals (min.) ......... Probability 1 ............... .15 2...
-
List the characteristics that differentiate an SNS from other types of online communities.
-
Refer to the previous question. Suppose that Electrotechs management decides that they need to make at least 20 generators and at least 20 alternators. a. Reformulate your LP model to account for...
-
On January 1, 2024, Pet Friendly Stores adopted the retail inventory method. Inventory transactions at both cost and retail, and cost indexes for 2024 and 2025 are as follows: Beginning inventory...
-
a. What are the required elements of arson? b. Tom breaks into a neighbors barn, sets off 20 sticks of dynamite, and blows up the barn. The barn does not catch fire, but it is blown to small bits and...
-
Albert agreed orally with Patty to sell Patty's rowboat for her, at a minimum price of $350,00 The law recognizes various kinds of authority, e.g, express, implied, etc Briefly explain the concept of...
-
A 4 in. sch 80 pipe carries water from a storage tank on top of a hill to a plant at the bottom of the hill. The pipe is inclined at an angle of $20^{\circ}$ to the horizontal. An orifice meter with...
-
A tank that is vented to the atmosphere contains a liquid with a density of $0.9 \mathrm{~g} / \mathrm{cm}^{3}$. A dip tube inserted into the top of the tank extends to a point $1 \mathrm{ft}$ from...
-
The flow rate in a $1.5 \mathrm{in}$. ID line can vary from 100 to $1000 \mathrm{bbl} /$ day, and you must install an orifice meter to measure it. If you use a differential pressure (DP) cell with a...
-
An orifice with a 3 in. diameter hole is mounted in a 4 in. diameter pipeline carrying water. A manometer containing an immiscible fluid with a specific gravity (SG) of 1.2 connected across the...
-
You are to specify an orifice meter for measuring the flow rate of a $35^{\circ} \mathrm{API}$ distillate $(\mathrm{SG}=0.85)$ flowing in a $2 \mathrm{in}$. sch 160 pipe at $70^{\circ} \mathrm{F}$....
-
Albinism is an autosomal genetic condition characterized by a lack of melanin production. In humans, it is recessive to normal body pigmentation. If a homozygous man with normal melanin production...
-
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...
-
A dynamic absorber is to be designed to eliminate the vibration at coordinate \(x_{1}\) for the system shown in Fig. P5.6, where the excitation frequency is \(400 \mathrm{rad} / \mathrm{s}\) and the...
-
After installation, it was found that a particular machine exhibited excessive vibration due to a harmonic excitation force with a frequency of \(100 \mathrm{~Hz}\). A dynamic absorber was designed...
-
Given the eigenvalues and eigenvectors for the two degree of freedom system shown in Fig. P5.9, complete the following. \[\begin{array}{ll} s_{1}^{2}=-1 \times 10^{6} \mathrm{rad} / \mathrm{s}^{2} &...
Study smarter with the SolutionInn App