[Tutor] BMI Question

Dwight Hutto dwightdhutto at gmail.com
Tue Sep 25 01:25:07 CEST 2012


On Mon, Sep 24, 2012 at 7:13 PM, Alan Gauld <alan.gauld at btinternet.com> wrote:
> On 24/09/12 20:13, Aija Thompson wrote:
>>
>> Hi!
>>
>> So I've been working on this question for hours! And Python keeps giving
>> me an error saying that my syntax for BMI is wrong. I really can't
>> understand why.
>
>
I'd suggest an editor, or editor option that highlights the end of
certain code separators like brackets/parenthesis

>
> So send us the full error text not a summary.
>
> If Python reports a syntax its usually recorded at the point immediately
> after the error so you may have to look at the line before.
>
>> So this is what I have so far:
>>
>> w = raw_input('Please give your weight in lbs: ')
>> h = raw_input('Now your height in feet and inches: ')
>> h. split("'")
>> ft, inches = h. split("'")
>> h_sum = float(12*int(ft)) + (int(inches.strip('"'))
>
>
> count the parens in the last expression...
>
>> BMI = float(703*w)/float(h_sum*h_sum)
>> print 'Your BMI is: ', BMI
>
>
>
>
> HTH
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor



-- 
Best Regards,
David Hutto
CEO: http://www.hitwebdevelopment.com


More information about the Tutor mailing list