We respect your right to privacy. You can choose not to allow some types of cookies. Your cookie preferences will apply across our website.
Any python programmers out there wanna take a look at my code and see why it isn't working
def vo2max_resting(age, resting_pulse):
""" takes age in years and resting pulse in beats per minute"""
return 15.3 * (208 - 0.7 * age) / resting_pulse
def vo2max_step_3min(gender, pulse):
"""returns pulse according to the 3 minute step test"""
if gender is "m":
return 111.33 - (0.42 * pulse)
elif gender is "f":
return 65.81 - (0.1847 * pulse)
else:
return -1
"""program that returns vo2max after input from users"""
def main():
"""returns vo2max after user input"""
name_string = input("Enter given name: ")
name = str(name_string.capitalize())
family_name_string = input("Enter family name: ")
family_name = str(family_name_string.upper())
gender_string = input("Enter gender (m/f): ")
gender = str(gender_string)
age_string = input("Enter age (in years): ")
age = int(age_string)
resting_string = input("Enter resting heart rate (bpm): ")
resting = int(resting_string)
step_test_string = input("Enter pulse after 3min step test: ")
step_test = int(step_test_string)
if gender is "m":
print("----------------------------------------")
print("Results for: " + family_name + "," + " " + name)
print('vo2max from resting pulse =')
main()
test_age = 29
test_pulse = 100
result = vo2max_resting(test_age, test_pulse)
print('{:.2f}'.format(result))
to many spaces bro
>>81416
Python's syntax relies heavily on its indentation. If you're getting any errors from the code you just posted, fix the indentation because It ran just fine for me after manually indenting it.
>>81416
Seems to be working fine here after I finished writing your main(). I added a few comments for you.
http://pastie.org/private/2qh8ic8x2pwrjsf4q8dw
Next time use pastebin or pastie like I did above so we can get the correct indentation. Also, next time post any error messages or describe what you mean by "isn't working." If you meant that the program isn't giving the correct result, I'd guess your formulas are wrong, because the code itself seems fine.
>>81416
Holy shit, I did the first part of this a few days ago.
Why don't you post your whole course, so we can do the whole thing for you?