减肥运动心率公式小脚本

2018-08-05  本文已影响0人  夜明一

第一个写的小角本留了下来怀念过去。

#author:YE

print("这是一个用于测算减脂和运动心率的下程序")

#减值公式:  减肥心率 = [(220-你的年龄)-静态心率]×(50%~60%)+静态心率

#我们需要获取两个关键变量值,name_age and (Resting Heart Rate)rest_heart_rate l两个值。
#因为是一个区域值,这里我们需要计算两次。 max_heart_rate and low_heart_rate

def fat(name_age,rest_heart_rate):
    max_heart_rate = ((220 - name_age)-rest_heart_rate) * 0.6 + rest_heart_rate
    low_heart_rate = ((220 - name_age)-rest_heart_rate) * 0.5 + rest_heart_rate
    return (max_heart_rate,low_heart_rate)

while True:
     name_age = int(input("Please enter your age >>>"))
     rest_heart_rate = int(input("Please enter Resting Heart Rate >>>"))
     your_fat = fat(name_age,rest_heart_rate)
     print("你的减脂心率适合维持在 %s 到 %s 之间,超出或低于都不利于减脂" %(round(your_fat[1]),round((your_fat[0])))
上一篇 下一篇

猜你喜欢

热点阅读