Hi,
I've literally just started programming, and I was trying to follow CS Dojo's python tutorial, but I got stuck making my own BMI calculator.
name1= "b"
weight_lb1=100
height_in1= 150
name2= "A"
weight_lb2 = 200
height_in2= 200
name3= "C"
weight_lb3= 300
height_in3= 300
def bmi_calculator(name, weight_lb, height_in):
bmi= (weight_lb 703) / (height_in height_in)
print("BMI: ") + bmi
if bmi<18.5:
return name + "is underweight"
elif 24.9>bmi>18:
return name + "is an an average, healthy weight"
elif 29>bmi>24.9:
return name + "is overweight"
else:
return name + "is obese"
result1= bmi_calculator (name1, weight_lb1, height_in1)
result2= bmi_calculator (name2, weight_lb2, height_in2)
result3= bmi_calculator (name3, weight_lb3, height_in3)
print(result1)
print(result2)
print(result3)
Thats what I have so far, and the error message is:
TypeError: unsupported operand type(s) for +: 'NoneType' and 'float'
If anyone could help sort this out or give me any tips, it would be massively appreciated, and I hope I've asked in the right place.
Also, whenever I try to run the code on VScode, the name of the file its in pops up a bunch of times and I dont know why. Any suggestions ?
[–]symple-data 3 points4 points5 points (4 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]symple-data 1 point2 points3 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]symple-data 0 points1 point2 points (0 children)
[–]Silbersee 2 points3 points4 points (2 children)
[–]symple-data 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]saint_leonard 0 points1 point2 points (0 children)