Input blood type: "B+" Input list of available blood types: ["A-", "B+", "AB+", "O+", "B+", "B-"] Output survivability: True
Each person has different blood depending on which antibodies and antigens bind to the surface of their red blood cells. They can be categorized in many different ways, but the two most important are the ABO group system (with four groups: A, B, AB, O) and the Rh blood group system (with two groups: +, -). The chart below shows how you can determine whether blood is suitable for transfusion.
Hospitals have blood banks that collect blood donations and store them until they're needed by patients. Every time a patient needs a blood transfusion, the hospital needs to check that they have some suitable blood that can be accepted by the patient's body. Given a patient's blood type and a list of available blood types figure out if the patient will survive.
Input: The person's blood type as a string, and a list of strings with available blood types.
Output: True if the person can be saved, and false otherwise.
You must be logged in to view your submissions.
Let us know what you think about this problem! Was it too hard? Difficult to understand? Also feel free to discuss the problem, ask questions, and post cool stuff on Discourse. You should be able see a discussion thread below. Would be nice if you don't post solutions in there but if you do then please organize and document your code well so others can learn from it.