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


Introduction

Write a Python program to convert the distance (in feet) to inches, yards, and miles. I have used python 3.7 compiler for debugging purpose.


techstudy.org

HP 15 Core i3 7th gen Laptop(4GB, 1TB HDD, Windows 10) | Rs. 31,490

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

Result

python language techstudy.org

     





Related Topics




Popular Posts