+ 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")

21st Feb 2018, 6:41 AM
Anson So
Anson So - avatar
12 ответов
+ 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 :)
21st Feb 2018, 7:29 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 6
You just need to call your function. Add the line bmi_cal(a, b) and it works.
21st Feb 2018, 7:38 AM
David Ashton
David Ashton - avatar
+ 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(...
21st Feb 2018, 6:52 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 2
if you want to use height and weight you should convert them into a float(or string). float(input())
21st Feb 2018, 6:46 AM
davy hermans
davy hermans - avatar
+ 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")
21st Feb 2018, 7:05 AM
Colin
Colin - avatar
21st Feb 2018, 7:54 AM
Rupesh
Rupesh - avatar
+ 1
omggg thanksssss
21st Feb 2018, 7:57 AM
Anson So
Anson So - avatar
0
thankss but it still have syntax error in the line of def bmi_cal(weight, height):
21st Feb 2018, 6:48 AM
Anson So
Anson So - avatar
0
still error🙁
21st Feb 2018, 7:01 AM
Anson So
Anson So - avatar
0
it would be helpfull if you woul insert the code (bottom left ). That way we can see the error.
21st Feb 2018, 7:12 AM
davy hermans
davy hermans - avatar
0
thanksss a lottt
21st Feb 2018, 7:34 AM
Anson So
Anson So - avatar