maynul67

convert miles to km and vice versa

Jul 10th, 2021
624
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. print("Convert: \n1. miles to km \n2. km to miles")
  2.  
  3. unit1 = "1. miles to km"
  4. unit2 = "2. km to miles"
  5. dis = float(input("Enter distance:    "))
  6. unit = int(input("chose 1 or 2:   "))
  7.  
  8. if unit == 1:
  9.     result = dis *  1.61
  10.     print(result,"  km")
  11. elif unit == 2:
  12.     result = dis * 0.62
  13.     print(result, "  mi")
  14. else:
  15.     print("invalid input")
RAW Paste Data