[Tutor] BMI Question
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:
>> 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
> Alan G
> Author of the Learn to Program web site
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
More information about the Tutor