Weigh the protein
THE BRIEF
Researchers routinely compute a protein's mass, for example to compare it with a result from a mass spectrometer. Each amino acid residue has its own mass, and a protein's mass is the sum of its residue masses plus one water molecule (18.01056), because the chain keeps one extra hydrogen at one end and one hydroxyl at the other.
Your task. Given a protein string, print its mass rounded to three decimal places. The residue mass table is provided in the starter code.
Input. One line: a protein as one-letter amino acid codes.
Output. One number with three decimals.
GIVEN INPUT
Your code reads this from standard input (input() or sys.stdin), both here and when it is graded.
MAMAPRTEINSTRING
EXPECTED OUTPUT FOR THIS INPUT
1760.866
SKILLS YOU'LL USE
Stuck? These bank problems practise the same techniques.
Write your code
Check your understanding
A quick self-check, marked right here in your browser. It is not graded or saved.
Why do we add one water molecule to the sum of the residue masses?
Joining amino acids releases water at every bond; the free ends of the chain add back one H2O in total.
What does a mass spectrometer measure?
Comparing a computed mass with the measured one helps confirm which protein is in the sample.
Explain and submit
Explain how your program turns a protein string into one number, and describe one way this number could be used in a lab.
Your submissions (0)
You can look ahead; come back to finish this stage.