SHARE
TWEET

Untitled

a guest Oct 10th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class measure:
  2.     def __init__(self, measure):
  3.         self.measure = measure
  4. #:( this took me too long sir        
  5.  
  6. def menu():
  7.  
  8.     measure = input("What unit of measurement do you want to convert?")
  9.     if measure == "inch" or measure == "inches" or measure == "cm":
  10.         inches()
  11.     elif measure == "mile" or measure == "miles" or measure == "km":
  12.         miles()
  13.     elif measure == "feet" or measure == "foot" or measure == "m" or measure == "yards":
  14.         if measure == "m":
  15.             choice = input("Do you want to convert it to feet or yards?")
  16.             if choice == "feet":
  17.                 feet()
  18.             elif choice == "yards":
  19.                 yards()
  20.         elif measure == "yards":
  21.             yards()
  22.         elif measure == "feet":
  23.             feet()
  24.     elif measure == "gallons" or measure == "gallon" or measure == "l":
  25.         gallons()
  26.     elif measure == "pounds" or measure == "pound" or measure == "kg":
  27.         pounds()
  28.     elif measure == "ounces" or measure == "ounce" or measure == "g":
  29.         ounces()
  30.    
  31.    
  32. def inches():
  33.     unitnum = float(input("Input number wanted for conversion: "))
  34.     if measure == "cm":
  35.         unitnum = unitnum/2.54
  36.         print(unitnum, "inches")
  37.     else:
  38.         unitnum = unitnum * 2.54
  39.         print(unitnum, "cm")
  40.        
  41. def miles():
  42.     unitnum = float(input("Input number wanted for conversion: "))
  43.     if measure == "mile" or measure == "miles":
  44.         unitnum = unitnum * 1.6093
  45.         print(unitnum, "km")
  46.     else:
  47.         unitnum = unitnum/1.6093
  48.         print(unitnum, "miles")
  49.  
  50. def feet():
  51.     unitnum = float(input("Input number wanted for conversion: "))
  52.     if measure == "feet" or measure == "foot":
  53.         unitnum = unitnum * 0.3048
  54.         print(unitnum, "m")
  55.     else:
  56.         unitnum = unitnum/0.3048
  57.         print(unitnum, "feet")
  58.        
  59. def yards():
  60.     unitnum = float(input("Input number wanted for conversion: "))
  61.     if measure == "yards" or measure == "yard":
  62.         unitnum = unitnum * 0.9144
  63.         print(unitnum, "m")
  64.     else:
  65.         unitnum = unitnum/0.9144
  66.         print(unitnum, "yards")
  67.        
  68.        
  69. def gallons():
  70.     unitnum = float(input("Input number wanted for conversion: "))
  71.     if measure == "gallons" or measure == "gallon":
  72.         unitnum = unitnum * 4.546
  73.         print(unitnum, "l")
  74.     else:
  75.         unitnum = unitnum/4.546
  76.         print(unitnum, "gallons")
  77.        
  78. def pounds():
  79.     unitnum = float(input("Input number wanted for conversion: "))
  80.     if measure == "pounds" or measure == "pound":
  81.         unitnum = unitnum * 0.454
  82.         print(unitnum, "kg")
  83.     else:
  84.         unitnum = unitnum/0.454
  85.         print(unitnum, "pounds")
  86.        
  87. def ounces():
  88.     unitnum = float(input("Input number wanted for conversion: "))
  89.     if measure == "ounces" or measure == "ounce":
  90.         unitnum = unitnum * 28.35
  91.         print(unitnum, "g")
  92.     else:
  93.         unitnum = unitnum/28.35
  94.         print(unitnum, "ounces")
  95.        
  96.  
  97.  
  98.  
  99.        
  100.  
  101. menu()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top