Check red blood cell compatibility between donor and recipient.
For simplicity, only eight basic types of blood are considered.
The input of blood type can be in the form of:
There are 8 basic blood types based on presence or absence of three antigens: A, B, and Rh-D.
General rule:
Blood group 0 individuals do not have A or B antigens. Therefore, a group 0 individual can receive blood only from a group 0 individual, but can donate blood to individual with types A, B, 0 or AB.
Blood group A individuals have the A antigen. Therefore, a group A individual can receive blood only from individuals of groups A or 0, and can donate blood to individuals with type A or AB.
Blood group B individuals have the B antigen. Therefore, a group B individual can receive blood only from individuals of groups B or 0, and can donate blood to individuals with type B or AB.
Blood group AB individuals have both A and B antigens. Therefore, an individual with type AB blood can receive blood from AB0, but cannot donate blood to any group other than AB.
Rh-D negative individuals do not have Rh-D antigen. Therefore, Rh-D negative can receive blood only from other Rh-D negative individuals.
Rh-D positive individuals have Rh-D antigen. Therefore, Rh-D positive individual can receive blood from both Rh-D negative or positive individuals.
Individuals with 0- are universal donors. Individuals with AB+ are universal recipients.
The rules described are general. In practice, there are over 340 different blood-group antigens.
The function should check red blood cell compatibility between a donor and a recipient.
Return True
for compatibility between the donor and the recipient, False
otherwise.
If the input value is not a required type raise TypeError .
If the input value is not in the defined interval raise ValueError .