Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In chemistry, a mole is a very large, fixed quantity, specifically 6 0 2 , 2 1 4 , 0 7 6 , 0 0

In chemistry, a mole is a very large, fixed quantity, specifically 602,214,076,000,000,000,000,000(usually written as 6.02214076\times 1023). The molar mass of a substance is the mass in grams of one mole of the substance (grams / mole). A molar mass calculator is a program that computes the molar mass of a substance and the number of moles of a sample of that substance. To use a molar mass calculator, a chemist enters two inputs:
The formula for a molecule, such as H2O (water) or C6H12O6(glucose)
The mass in grams of a sample of the substance, such as 3.71
The calculator computes the molar mass of the molecule by doing the following for each element in the formula:
Sum the number of atoms of each element in the formula
Find the atomic mass of each element
Multiply the number of atoms by their atomic mass
Add the product into the molar mass of the molecule
Then the calculator computes the number of moles in the sample with this formula:
number_of_moles =
sample_mass
molar_mass
Finally, the calculator prints two results for the chemist to see:
the molar mass
the number of moles
Example
As an example, consider a sample of glucose (C6H12O6) with a mass of 12.37 grams. To use a molar mass calculator, a chemist enters
C6H12O6
12.37
The calculator computes the molar mass of glucose by doing the following:
Sum the number of atoms of each element in the formula for glucose:
6 carbon atoms
12 hydrogen atoms
6 oxygen atoms
Find the atomic mass of each element:
Symbol Name Atomic Mass
C Carbon 12.0107
H Hydrogen 1.00794
O Oxygen 15.9994
Multiply the number of atoms by their atomic mass:
6\times 12.0107=72.0642
12\times 1.00794=12.09528
6\times 15.9994=95.9964
Add the results of the multiplications to get the molar mass of glucose:
72.0642+12.09528+95.9964=180.15588 grams/mole
Then the calculator divides the mass of the sample of glucose by the molar mass of glucose which results in the number of moles in the sample:
12.37 grams
180.15588 grams/mole
=0.06866 moles
The calculator prints two results for the chemist to see:
the molar mass of glucose: 180.15588 grams/mole
the number of moles in the sample: 0.06866 moles
Assignment
During this assignment, you will write and test the remaining parts of the molar mass calculator that you started writing in the previous lessons prove milestone. When you are finished with this prove assignment, your chemistry.py program must contain at least three functions named as follows:
main
make_periodic_table
compute_molar_mass
Helpful Documentation
The prove milestone explains how a molar mass calculator should work.
The preparation content explains how to create and use a dictionary in a Python program.
The preparation content for week 3 explains how to use pytest, assert, and approx to automatically verify that functions are correct. It also contains an example test function and links to additional documentation about pytest.
Download the formula.py Python file and save it in the same folder where you saved your chemistry.py program from the previous prove milestone. The formula.py file includes a FormulaError class and a function named parse_formula. Both of them are complete and work correctly, and you should not change them.
Open the formula.py file in VS Code and read the triple quoted string at the top of the parse_formula function. As the triple quoted string states, the parse_formula function converts a chemical formula for a molecule, such as "C13H16N2O2"(melatonin), into a compound list, such as [["C",13],["H",16],["N",2],["O",2]]. This compound list is known as a symbol_quantity_list because it contains the symbols of chemical elements and the quantity of atoms of each element that appear in a chemical formula.
Copy and paste the following import statement into your chemistry.py program at the top of your program. This statement will import the parse_formula function from the formula.py file into your chemistry.py program so that you can call the parse_formula function in your program.
from formula import parse_formula
In your chemistry.py program, change the compound list that is in your make_periodic_table function to a compound dictionary. Each item in the dictionary should have a chemical symbol as the key and the chemical name and atomic mass in a list as the value, like this:
periodic_table_dict ={
# symbol: [name, atomic_mass]
"Ac": ["Actinium",227],
"Ag": ["Silver",107.8682],
"Al": ["Aluminum",26.9815386],
}
We strongly recommend that you use find and replace or multi-line editing in VS Code to quickly change the periodic table to a compound dictionary. If you don't know how to use find and replace or multi-line editing, ask a fellow student, a tutor, a teaching assistant, or your teacher for help.
Copy and paste the following Python code into your chemistry.py program. Be certain not to paste the code inside an existing function.
# Indexes for inner

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Main Memory Database Systems

Authors: Frans Faerber, Alfons Kemper, Per-Åke Alfons

1st Edition

1680833243, 978-1680833249

More Books

Students also viewed these Databases questions

Question

mple 10. Determine d dx S 0 t dt.

Answered: 1 week ago