Question
Using the following atomic weight: carbon 12.0110 hydrogen 1.0079 oxygen 15.9994 compute the molecular weight of a compound of carbon, hydrogen, and oxygen. Ask the
Using the following atomic weight:
carbon 12.0110 hydrogen 1.0079 oxygen 15.9994 compute the molecular weight of a compound of carbon, hydrogen, and oxygen.
Ask the user the number of atoms of each element with the following prompts in the order below, with a space after each colon:
Enter the number of carbon atoms:
Enter the number of hydrogen atoms:
Enter the number of oxygen atoms:
Compute the molecular weight by adding together the products of each atom type's molecular weight times its atom count, and print the result in a form as in the case for aspirin below:
Enter the number of carbon atoms: 9
Enter the number of hydrogen atoms: 8
Enter the number of oxygen atoms: 4
The molecular weight is 180.1598
Note as usual that in the output used for comparison for the first test case above, the user input and the newline character after it will not be visible. There is a second test case with hidden input.
Thanks for helping out. I'm new to programming and trying to write the code in python. Also, how would I allow my number input for instance (no_of_carbon_atoms = 9)- number be changed by the hidden input of online site? Should I qoute the number 9 or put ()...?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started