Distance conversion

This is a python program to convert distance from kilometers to miles.

print(" Distance conversion")
print("1.kilometer to miles",
      "2.miles to kilometer")

choice=int(input("Enter your choice"))
if choice==1:
    d1=int(input("Enter distance in kilometer"))
    d2=d1*0.621371
    print(f"Distance in miles is {d2}")
else:
    d1 = int(input("Enter distance in miles"))
    d2=d1/0.621371
    print(f"Distance in kilometer is {d2}")

 

Leave a Comment

%d bloggers like this: