 Python Program to Convert Distance in Feet to Inches, Yards, and Miles

Python program to convert the distance in feet to inches, yards and miles; In this tutorial, you will learn how to convert the distance in feet to inches, yards and miles in python.

Python program to convert a given height in centimeters to feet and inches; In this tutorial, you will learn how to convert height in cm to feet and inches.

Python Program to Convert Distance in Feet to Inches, Yards and Miles

Use the following steps and write python program to convert the distance in feet to inches, yards and miles:

• Take the distance in feet as input from user in program.
• Convert distance in feet to inches using this distance_inches = distance_ft * 12 formula.
• Convert distance in feet to yards using this distance_yards = distance_ft / 3.0 formula.
• Convert distance in feet to miles using this distance_miles = distance_ft / 5280.0 formula.
• Print convert the distance in feet into inches, yards and miles.
distance_ft = int(input("Input distance in feet: "))
distance_inches = distance_ft * 12
distance_yards = distance_ft / 3.0
distance_miles = distance_ft / 5280.0

print("The distance in inches is %i inches." % distance_inches)
print("The distance in yards is %.2f yards." % distance_yards)
print("The distance in miles is %.2f miles." % distance_miles)

Output

Input distance in feet:  1500
The distance in inches is 18000 inches.
The distance in yards is 500.00 yards.
The distance in miles is 0.28 miles.

Recommended Python Programs 