Answer to Question #137136 in Python for Isayiah

Question #137136
How do you write a program that inputs the length of two pieces of fabric in feet and inches (as whole numbers) and prints the total.
1
Expert's answer
2020-10-06T23:35:41-0400
# fabric_length.py
# Calculate the total length of two fabrics
print("Enter the length of the first fabric")
feet1 = int(input("Feet: "))
inches1 = int(input("Inches: "))
print("\nEnter the length of the second fabric")
feet2 = int(input("Feet: "))
inches2 = int(input("Inches: "))

inches = inches1 + inches2
feet = feet1 + feet2 + inches // 12
inches %= 12

print(f"The total length is {feet} feet and {inches} inch(es)")

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS