Great project for a beginner like me. Thank you! I just have one problem, when I try this, it tells me:
BMI = (height * weight) TypeError: can't multiply sequence by non-int of type 'str'
Any idea what might fix this?
when you input something python automaticly see it as a string. Make sure you put float in front of height and weight formula. weight = float(input("Enter your weight in cm: ")) height = float(input("Enter your height in cm: "))
Also I think that BMI = (height * weight) is wrong. It should be BMI = weight_kg / (height_cm/100)**2
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Great project for a beginner like me. Thank you! I just have one problem, when I try this, it tells me:
BMI = (height * weight)
TypeError: can't multiply sequence by non-int of type 'str'
Any idea what might fix this?
when you input something python automaticly see it as a string. Make sure you put float in front of height and weight formula.
weight = float(input("Enter your weight in cm: "))
height = float(input("Enter your height in cm: "))
Also I think that BMI = (height * weight) is wrong. It should be
BMI = weight_kg / (height_cm/100)**2