def calculate_protein_weight(protein, mass_table):
    """
Given a protein sequence as string and a mass table as dictionary
(with amino acids as keys and their respective weights as values),
calculate the molecular weight of the protein by summing up the
weight of each amino acid in the protein.
    """
    total_weight = 0
    
    for amino_acid in protein:
        weight = mass_table[amino_acid]
        total_weight += weight
        
    return round(total_weight, 3)