BMI and Karvonen Calculator python



https://softchalkcloud.com/lesson/serve/njUvRZqCb1mDIH/html

这是我正在做的项目,离完成还差得很远。我一直在得到这个输出,以进行重量转换计算,从磅到公斤函数weight_in_kg位于0x000002028E06BAC0,我不知道的原因

def weight_in_kg(lbs):
wieght_in_kg = lbs * 0.45359237
return weight_in_kg
def height_meters(inches):
height_meters = inches / 39.3700787
return height_meters
def height_square_meters(meters):
height_sqaure_meters = meters ** 2
return height_square_meters
def get_weight(prompt):
weight_in_pounds = input(prompt)
while not weight_in_pounds.isdigit():
print('Please enter an integer ')
weight_in_pounds = input('Try and enter your weight in pounds again')
weight_in_pounds = int(weight_in_pounds)
return weight_in_pounds
def get_height(prompt):
height_inches = input(prompt)
while not height_inches.isdigit():
print('Please enter and integer ')
height_inches = input('Try and enter your height in inches again')
height_inches = int(height_inches)
return height_inches

patient_weight_pounds = get_weight('Enter your weight in pounds ')
patient_weight_kg = weight_in_kg(patient_weight_pounds)
print(patient_weight_kg)
test = weight_in_kg(100)
print(test)

当您修改weight_in_kg函数时,您将收到正确的输出。我认为您的问题是返回了函数的内存地址,而不是结果。

def weight_in_kg(lbs):
weight_in_kgs = lbs * 0.45359237
return weight_in_kgs

最新更新