Question: Do the following: Using VS Code, create a new file and save it as chemistry.py In the chemistry.py file, write a function named make _
Do the following:
Using VS Code, create a new file and save it as chemistry.py
In the chemistry.py file, write a function named makeperiodictable that takes no parameters and creates and returns a compound list. The compound list must contain all the data in the table of elements shown in the Table of Elements section above. The data within the compound list must be organized like this:
periodictablelist
# symbol name, atomicmass
Ac "Actinium",
Ag "Silver",
Al "Aluminum",
We strongly recommend that you do not type the data in the table of elements but instead that you copy and paste the data from this assignment into your program. If you dont know how to use copy and paste to help you quickly write the makeperiodictable function, ask a fellow student, a tutor, a teaching assistant, or your teacher for help.
After you copy and paste the periodic table data into your program, you must add square brackets and and commas so that the data is organized in a compound list. If youre using VS Code as your text editor, you can use multiline editing to quickly add all the necessary square brackets and commas.
In the chemistry.py file, write the main function that takes no parameters and returns nothing. The main function should do the following:
Get a chemical formula for a molecule from the user.
Get the mass of a chemical sample in grams from the user.
Call the makeperiodictable function and store the returned list in a variable.
Print the name and atomic mass for each chemical element on a separate line. Do not print the chemical element symbols.
At the bottom of your chemistry.py file, add a call to the main function. Be certain to protect the call to main with an if statement as taught in the preparation content for week
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
