Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The first 10 elements of the periodic table and some of their properties can be found in Table 2 These elements can be combined

image

The first 10 elements of the periodic table and some of their properties can be found in Table 2 These elements can be combined to create molecules. For example, two hydrogen atoms (2H) can be added to an oxygen (O) atom to create a water molecule (HO). This combination can be written as 2H + 10 HO (or more commonly HO). Write a Python program that can add elements together. Your program should: 1. Ask the user to enter a string of the form xA+yB + C + ..., where x, y, and z are positive integers (called stoichiometric coefficients) and A, B, and C are distinct symbols of elements. Examples include 2H + 10 and 1C + 20. The user should be asked to enter the string again if a stiochiometric coefficient is not a positive integer, or if a symbol does not match any of the elements in Table 2. The formula for the molecule should then be printed to the screen as AxByCz (e.g. C2H4). If any of the stoichiometric coefficients are 1, then they should not be printed (e.g. H201 should be H2O, C102 should be CO2). 2. Calculates the atomic mass of the molecule. The atomic mass of a molecule is equal to the sum of the atomic masses of each element present in the molecule multiplied by the stoichiometric coefficient for that element. This value should be printed to the screen. Table 2: The first 10 elements of the periodic table. Symbol Atomic mass H He Element Hydrogen Helium Lithium Li Beryllium Be Boron B Carbon C Nitrogen N Oxygen Fluorine Neon F Ne 1 4 7 9 11 12 14 16 19 20

Step by Step Solution

3.51 Rating (154 Votes )

There are 3 Steps involved in it

Step: 1

The Pyth... 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

Understanding Financial Statements

Authors: Lyn Fraser, Aileen Ormiston

11th edition

133874036, 978-0133874037

More Books

Students also viewed these Programming questions

Question

Describe three popular program manipulation techniques.

Answered: 1 week ago

Question

What do you see as your biggest strength/weakness?

Answered: 1 week ago

Question

What is an insurable interest? Why is it important?

Answered: 1 week ago