📌  相关文章
📜  Python程序可将公里转换为英里

📅  最后修改于: 2021-04-30 02:40:35             🧑  作者: Mango

公里是公制系统中长度的单位,等同于1000米。

英里也是长度单位,等于1760码。

例子:

Input: 5.5 
Output: 3.418 

Input: 6.5
Output: 4.039

公式:

1 kilometer equals 0.62137 miles.
Miles = kilometer * 0.62137   
Kilometer = Miles / 0.62137
# Python3 program to convert
# kilometers to miles
  
# driver code
kilometers = 5.5
  
# conversion factor
conv = 0.621371
  
# calculate miles
miles = kilometers * conv
print('%0.3f kilometers is equal to %0.3f miles' %(kilometers,miles))
  
kilometers = 6.5
  
# calculate miles
miles = kilometers * conv
print('%0.3f kilometers is equal to %0.3f miles' %(kilometers,miles))

输出:

5.500 kilometers is equal to 3.418 miles
6.500 kilometers is equal to 4.039 miles