Q:

Write a Python program to convert the distance (in feet) to inches, yards, and miles

belongs to collection: python basic programs with examples

0

Write a Python program to convert the distance (in feet) to inches, yards, and miles

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

I have used python 3.7 compiler for debugging purpose.

d_ft = int(input("Input distance in feet: "))
d_inches = d_ft * 12
d_yards = d_ft / 3.0
d_miles = d_ft / 5280.0
 
print("The distance in inches is %i inches." % d_inches)
print("The distance in yards is %.2f yards." % d_yards)
print("The distance in miles is %.2f miles." % d_miles)

Result:

Input distance in feet: 5

The distance in inches is 60 inches.

The distance in yards is 1.67 yards.

The distance in miles is 0.00 miles.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

python basic programs with examples

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Write a Python program Convert all units of time i... >>
<< Write a Python program to convert height (in feet ...