[Tutor] BMI calc

Mark Lawrence breamoreboy at yahoo.co.uk
Wed Mar 13 02:46:10 CET 2013


On 13/03/2013 00:05, Soliman, Yasmin wrote:
> Hello all,
>
> I'm new to python and its been a stuggle so far. I'm attempting to create a BMI calculator in Wing 101 4.1. I keep getting syntax errors:
>
> def calc_BMI(weight,height):
>      return (weight/(height*height))*703.0
> if bmi <=18.5:
>      print 'underweight'
> elif bmi >= 18.5 and bmi <=24.9:
>          print 'normal weight'
> elif bmi >=25 and bmi <=29.9:
>              print 'overweight'
> elif bmi >=30:
>                  print 'obese'
>
> Also, height should be converted to inches and I have not the slightest clue how to so. Any help would be much appreciated.
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>

If you're using Python 3 you'll get syntax errors as print is a 
function, not a statement as in Python 2.  Is this your problem?  If not 
please cut and paste the exact syntax error for us to see.  Then we'll 
sort the rest of the problems :)

-- 
Cheers.

Mark Lawrence



More information about the Tutor mailing list