repl.it
@heyitsmarcus/

Feet and Inches

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#not my code, help file for Repl Talk->Ask

import math
feet1=float(input("Enter the Feet for the first piece of fabric: "))
inches1=float(input("Enter the Inches for the first piece of fabric: "))
feet2=float(input("Enter the Feet for the second piece of fabric: "))
inches2=float(input("Enter the Inches for the second piece of fabric: "))
#Get the initial total amount of feet
initialFeet = feet1 + feet2
#Get the initial total amount of inches
initialInches = inches1 + inches2
#Get the remaining inches which is a modulus of 12 (12 inches in 1 foot)
remainingInches = initialInches % 12
#Get the addiitonal feet to add from the total initial inches
#This total has to be divided by 12 and then have a floor done on it which will remove any decimal values
additionalFeet = math.floor(initialInches / 12)
#The total feet will be the initial feet (feet1 and feet2) plus the additional calculated feet
totalFeet = initialFeet + additionalFeet

print ("Total: Feet: " + str(totalFeet) + " Inches: " + str(remainingInches))