Aug-26-2019, 05:00 AM
Hey.. I was writing the code for calculating protein net charge
when I am providing in input the available keys it is working fine.. However, when key is not available it is giving error.. although I have provided the error statement in .get(, 'my error msg')
How to get my error message..
Is it because of print command?
when I am providing in input the available keys it is working fine.. However, when key is not available it is giving error.. although I have provided the error statement in .get(, 'my error msg')
How to get my error message..
Is it because of print command?
# calculating charge of proteins prot_seq = input('please put the protein sequence here = ').upper() print(prot_seq) aa_charge = {'C':-0.405, 'D':-0.999, 'E':-0.998, 'K':1, 'R':1} net_charge = 0 for i in prot_seq: net_charge += aa_charge.get(i, 'the sequence is not valid') print(net_charge)