python根据距离和时长计算配速示例

代码如下:

function cal_pace(d,h,m,s){ var distance = d; var hours = h; var minutes = m; var seconds = s; if(distance.length > 0 && hours.length > 0 && minutes.length > 0 && seconds.length > 0) { var speed = parsefloat(hours) * 60.0 + parsefloat(minutes) + parsefloat(seconds) / 60.0; speed = speed / parsefloat(distance); var speed_minutes = math.floor(speed); var speed_seconds = math.floor((speed – speed_minutes) * 60.0); return (speed_minutes + ‘\” + speed_seconds + ‘\”‘).tostring(); } return ‘0\’0\”‘;}

发表评论