[Tutor] BMI Question

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


On Mon, Sep 24, 2012 at 7:25 PM, Dwight Hutto <dwightdhutto at gmail.com> wrote:
> 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...
>>
Proper netiquette suggests I place this here:

I'd suggest an editor, or editor option that highlights the end of
certain code separators like brackets/parenthesis so you can see the
in depth parameters placed into code.

>>> BMI = float(703*w)/float(h_sum*h_sum)
>>> print 'Your BMI is: ', BMI

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



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


More information about the Tutor mailing list