+ 1
[SOLVED] Can someone fix my programme
bmi calculatot with syntax error import define print("Hi, what is your name?") name=input("My name is...") print("Hi!", name) a=input("What is your weight?") b=(input("Height?") def bmi_cal(weight, height): bmi = weight / (height**2) print(name) print("bmi: ") print (bmi) if bmi < 25: print(name + "is not overweight") else: print(name + "is overweight")
12 Respostas
+ 6
I think the code is fine now. Just don't forget to call the method you defined :)
bmi_cal(a, b)
# Btw, you might think of specifying the measurement units. I entered kg and cm, respectively and got weird results :)
+ 6
You just need to call your function. Add the line
bmi_cal(a, b)
and it works.
+ 5
It's because you didn't close the parenthesis "(" in b assignment. By the way, it's not needed there at all.
Line 7:
b=(input(...
+ 2
if you want to use height and weight you should convert them into a float(or string).
float(input())
+ 1
All you have to do is remove the ( parenthesis right after b=
Updated version:
print("Hi, what is your name?")
name=input("My name is...")
print("Hi!", name)
a=input("What is your weight?")
b=input("Height?")
def bmi_cal(weight, height):
bmi = weight / (height**2)
print(name)
print("bmi: ")
print (bmi)
if bmi < 25:
print(name + "is not overweight")
else:
print(name + "is overweight")
+ 1
improved version..
https://code.sololearn.com/cNw8kpoJwwlg/?ref=app
+ 1
omggg thanksssss
0
thankss but it still have syntax error in the line of
def bmi_cal(weight, height):
0
still error🙁
0
it would be helpfull if you woul insert the code (bottom left ). That way we can see the error.
0
thanksss a lottt