Having trouble with BMI calculator math | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

Having trouble with BMI calculator math

Iā€™m getting an error for line 3: Type Error, but I canā€™t find anything in the lessons that says floats canā€™t be exponents? What am I missing? 1 w=input(int()) 2 h=input(float()) 3 bmi=(w/(h**2))

19th Jun 2022, 11:46 AM
Melissa Fonseca
Melissa Fonseca - avatar
2 Respostas
+ 4
Currently, your program is treating 'w' and 'h' variables as strings. You need to first take the input and then convert it to float. w = float(input())
19th Jun 2022, 11:58 AM
Sandeep
Sandeep - avatar
+ 2
Thank you Sandeep!
19th Jun 2022, 12:04 PM
Melissa Fonseca
Melissa Fonseca - avatar