121k views
0 votes
2.3 Code Practice: Question 2

Write a program that inputs the length of two pieces of fabric in feet and inches (as whole numbers) and prints the total

User Piepera
by
5.7k points

1 Answer

7 votes

Answer:

feetFab1 = int(input(""Enter the value in feet for the 1st piece of fabric: ""))

inchFab1 = int(input(""Enter the value in inches for the 1st piece of fabric: ""))

feetFab2 = int(input(""Enter the value in feet for the 2nd piece of fabric: ""))

inchFab2 = int(input(""Enter the value in inches for the 2nd piece of fabric: ""))

feetSum = (feetFab1 + feetFab2)

inchSum = (inchFab1 + inchFab2)

totalFeet = ((inchSum % 12) + feetSum)

totalInch = (feetSum % 12)

print (""Feet: "" + str(totalFeet) + "". Inches: "" + str(totalInch))

User David Yue
by
6.5k points