# I have to write a Python program relating with molecular weight. Any insight?

Write a program that determines the molecular weight of a chemical compound based on the number of hydrogen, carbon, and oxygen atoms in the compound. You should use the following atomic weights: \begin{array}{|c|c|c|c|} \hline \text{Atom} & \text{Weight}~\pu{gm/mole} \\\hline \ce{H} & 1.0079 \\\hline \ce{C} & 12.011\\\hline \ce{O} & 15.9994\\\hline \end{array}

I don’t understand the relation between molecular weight and the number of $\ce{H}$, $\ce{C}$, and $\ce{O}$.

The professor has said "there is no need to be able to handle chemical compound names like $\ce{H2O}$ or $\ce{C2H5OH}$. (I plan to discuss how to handle these later in class) Instead, the user should just be asked to specify the number of hydrogen, carbon, and oxygen atoms in the compound.”

I need help to proceed.

total_mass = num_hyd * 1.0079 + num_carb * 12.011 + num_oxy * 15.9994

... before returning total_mass as the answer.