Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from fractions import Fraction
- while True:
- select = str(raw_input("To convert to metirc type 'm', or imperial type 'i': "))
- if select == str("m"):
- mm = float(25.4)
- numer = int(raw_input("Top number(numerator)? "))
- denom = int(raw_input("Bottom number(denominator)? "))
- answer = float(mm/denom*numer)
- print str(answer)+"mm"
- numer = int(0)
- denom = int(0)
- answer = int(0)
- if select == str("i"):
- sixteenth = float(1.587)
- mm = float(raw_input("Millimeters(mm)? "))
- answer = float(mm/sixteenth)
- decimal = float(round(answer))/16
- print str(Fraction(decimal))
- decimal = int(0)
- mm = int(0)
- answer = float(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement