首頁 >後端開發 >Python教學 >python根据距离和时长计算配速示例

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB原創
2016-06-16 08:45:161398瀏覽

复制代码 代码如下:

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\"';
}
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn