+ 1

can you help me to spot the error?

i have written a code and i am stuck on an error .plz help. the code : https://code.sololearn.com/c23gBVJG8r32 the error: Traceback (most recent call last): File "file0.py", line 5, in <module> bmi = weight_kg // height_m * height_m TypeError: unsupported operand type(s) for //: 'str' and 'str'

8th Sep 2021, 1:44 PM
damanistopme
damanistopme - avatar
6 Réponses
+ 2
Looks like your code is big enough. So please post it in the code playground and attach the code with a description.If you don't know how to do it then you can have a look at it: https://www.sololearn.com/post/75089/?ref=app
8th Sep 2021, 1:45 PM
Pariket Thakur
Pariket Thakur - avatar
+ 1
height_m and weight_kg needs to be converted to integers for them to divide, as you can't divide strings with each other. To convert these variables you need to include the int() function. Like the following: height_m = int(input()) weight_kg = int(input())
8th Sep 2021, 1:50 PM
Ethan
Ethan - avatar
+ 1
okay thanks a lot to both of you
8th Sep 2021, 1:55 PM
damanistopme
damanistopme - avatar
0
oh okay HrCoder
8th Sep 2021, 1:46 PM
damanistopme
damanistopme - avatar
0
done
8th Sep 2021, 1:48 PM
damanistopme
damanistopme - avatar
0
damanistopme on height_m = input() weight_kg = input() Use height_m =int( input()) weight_kg = int(input()) because input() === string
8th Sep 2021, 1:49 PM
Pariket Thakur
Pariket Thakur - avatar