Skip to content

Python 106 公里英哩換算

Python TQC

題目說明:

假設一賽跑選手在x分y秒的時間跑完z公里,請撰寫一程式,輸入x、y、z數值,最後顯示此選手每小時的平均英哩速度(1英哩等於1.6公里)。

Tip

輸出浮點數到小數點後第一位。

範例輸入
10
25
3

範例輸出

Speed = 10.8

Solution

1
2
3
4
x = eval(input())
y = eval(input())
z = eval(input())
print("Speed = %.1f"%(z/1.6/((y/60+x)/60)))

Tip

平均英哩 = 英哩 / 小時
公哩 / 1.6 = 英哩
分 / 60 = 小時


Last update : 13 novembre 2024
Created : 13 novembre 2024

Comments

Comments