python - I been asked to write a program that prompts the user for a measurement in meters and then converts it in to miles, feet and inches -
# programme convert meters miles # prompts input user meters = float(input("how many meters?: ")) # convert factor conv_fac = 0.000621371 # calculate miles miles = meters * conv_fac print("%0.3f meters equal %0.3f miles" %(meters, miles))
so question how proceed go on convert feet , inches if right convert miles. need convert miles entered feet?
yes. 1 mile = 5280 feet. so: feet = miles * 5280
1 foot = 12 inches. so: inches = feet * 12
python
No comments:
Post a Comment