DNA to Protein Toolkit
0 of 4 stages done
  1. 1 Profile the fragment
  2. 2 Transcribe and mirror
  3. 3 Translate to protein
  4. 4 Weigh the protein
STAGE 4 OF 4

Weigh the protein

Code not passed yet Explanation needed Self-check
You are browsing as a guest: read the stage and run code freely. To be graded and save your progress, sign in or create an account →

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

.ipynb
Shift + Enter runs a cell. Your notebook runs and is saved in this browser only; nothing is sent to us until you submit in step 3.

Check your understanding

A quick self-check, marked right here in your browser. It is not graded or saved.

1.

Why do we add one water molecule to the sum of the residue masses?

2.

What does a mass spectrometer measure?

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.

Submitting sends the code in your solution cell and this explanation. The code is checked on our server against the given input and hidden tests. The stage is complete when the code passes and the explanation has at least 25 words.

You can look ahead; come back to finish this stage.