Complete the function blood_donor, which determines whether a person is able to donate blood. A per 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 a
Complete the function blood_donor, which determines whether a person is able to donate blood. A per 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 a
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
![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
Return Value
blood_donor (21, 50, 'A', 'A')]
blood_donor (16, 50, 'A', 'B')
blood_donor (20, 48, '0', 'A')
blood donor (17, 47, 'B', 'B')
blood_donor (21, 70, 'A', 'B') mismatch
match
too young
too light
too young, too light
1 def blood_donor (age, mass, requested_blood_type, donor_blood_type):
2
return 'Error' # DELETE THIS LINE and start coding here.
3
# 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',
9 print (blood_donor (20, 48, '0', 'A'))
10 print (blood_donor (17, 47, 'B', 'B'))
11 print (blood_donor (21, 70, 'A', 'B'))](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fa684ef64-b106-44e3-b477-7930de74cd26%2F1fce3511-fa07-4b2b-93a7-e8e8a2456f2b%2F2enp1lo_processed.png&w=3840&q=75)
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
Return Value
blood_donor (21, 50, 'A', 'A')]
blood_donor (16, 50, 'A', 'B')
blood_donor (20, 48, '0', 'A')
blood donor (17, 47, 'B', 'B')
blood_donor (21, 70, 'A', 'B') mismatch
match
too young
too light
too young, too light
1 def blood_donor (age, mass, requested_blood_type, donor_blood_type):
2
return 'Error' # DELETE THIS LINE and start coding here.
3
# 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',
9 print (blood_donor (20, 48, '0', 'A'))
10 print (blood_donor (17, 47, 'B', 'B'))
11 print (blood_donor (21, 70, 'A', 'B'))
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education