编写一个 Python示例,将公里转换为米、厘米和毫米。这个 Python 示例允许插入公里,并将它们转换为米、毫米和厘米。我们知道,一公里等于 1000 米,100000 厘米,1000000 毫米。
# Kilometers to Meter, Centimeter, and Millimeter
kilometers = float(input("Please Enter the Kilometers = "))
meter = kilometers * 1000
centimeter = kilometers * 100000
millimeter = kilometers * 1000000
print("%.2f Kilometers = %.2f Meters" %(kilometers, meter))
print("%.2f Kilometers = %.2f Centimeters" %(kilometers, centimeter))
print("%.2f Kilometers = %.2f Millimeters" %(kilometers, millimeter))
标签: 源码