Question: Write a program that adds two weights. Both weights are expressed in pounds and ounces and the resulting sum should also be expressed in pounds

Write a program that adds two weights. Both weights are expressed in pounds and ounces and the resulting sum should also be expressed in pounds and ounces. Note that there are 16 ounces in a pound.

Given the following initial values:

pounds1 = 7 ounces1 = 8 pounds2 = 9 ounces2 = 11 

the program should produce the following output:

7 pounds and 8 ounces added to 9 pounds and 11 ounces is equal to 17 pounds and 3 ounces 

Please note the following:

  • Do not include the above variable initialization statements in your code. They will be provided for you with each CodeRunner test case.
  • You can assume all 4 variables will always be assigned integer values.
  • You need to use the modulus (%) and floor division (//) operators in your calculations.

For example:

Test Result
pounds1 = 7 ounces1 = 8 pounds2 = 9 ounces2 = 11
7 pounds and 8 ounces added to 9 pounds and 11 ounces is equal to 17 pounds and 3 ounces
pounds1 = 3 ounces1 = 4 pounds2 = 5 ounces2 = 6
3 pounds and 4 ounces added to 5 pounds and 6 ounces is equal to 8 pounds and 10 ounces

python please faster

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!