编写 Python示例,将厘米转换为米和公里。这个 Python 示例允许输入厘米,并将其转换为千米和米。我们知道,一米等于 100 厘米,一公里等于 10 万厘米。
# Centimeter to Meters and Kilometers
centimeter = float(input("Please Enter the Centimeters = "))
meter = centimeter/100
kilometers = centimeter/100000
print("%.2f Centimeters = %.2f Meters" %(centimeter, meter))
print("%.2f Centimeters = %.2f Kilometers" %(centimeter, kilometers))
标签: VScode