My code gives me error for some reason

I have this code but it keeps printing error.
Problem: Write a program that will use a function to determine the molecular weight of an amino acid when given the number of atoms of oxygen, carbon, nitrogen, sulfur and hydrogen
Here is what i tried:

def Weight1(enter1,enter2,enter3,enter4,enter5):
    answer=(12.011*float(enter1))+(12.011*float(enter2))+(12.011*float(enter3))+(12.011*float(enter4))+(12.011*float(enter5))
    return answer
enter1=input("Enter the number of Carbon:")
enter2=input("Enter the number of Hydrogen:")
enter3=input("Enter the number of Nitrogen:")
enter4=input("Enter the number of Oxygen:")
enter5=input("Enter the number of Sulfur:")
answer=(12.011*enter1)+(1.00794*enter2)+(14.00674*enter3)+(15.9994*enter4)+(32.066*enter5)

Sum_of_Weights=answer
print("The molecular weight of that Amino Acid is:",Sum_of_Molecular_Weights)
1 Like

I think I got the idea right?
My new work:

def Weight1 (enter1,enter2,enter3,enter4,enter5):
    answer=((float(enter1)*12.011)+(float(enter2)*1.00794)+(float(enter3)*14.00674)+(float(enter4)*15.9994)+(float(enter5)*32.066))
    return answer

enter1=input("Enter the number of Carbon:")
enter2=input("Enter the number of Hydrogen:")
enter3=input("Enter the number of Nitrogen:")
enter4=input("Enter the number of Oxygen:")
enter5=input("Enter the number of Sulfur:")


answer=((float(enter1)*12.011)+(float(enter2)*1.00794)+(float(enter3)*14.00674)+(float(enter4)*15.9994)+(float(enter5)*32.066))

print("The molecular weight of that Amino Acid is:",answer)

Would you mind sharing what error are you getting?

The value returned from the input function is a string, so you will need to convert the string to a number to be able to perform calculations with the numbers enter by user.