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:
Python4U
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.