[Tutor] BMI Question

Stephen Haywood stephen at averagesecurityguy.info
Mon Sep 24 21:21:01 CEST 2012


On Sep 24, 2012, at 3:16 PM, Aija Thompson <aijathompson at hotmail.com> 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.

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("'")

   ^^^^^
This doesn't seem necessary.

ft, inches = h. split("'")
h_sum = float(12*int(ft)) + (int(inches.strip('"'))

   ^^^^^
You have three opening parents on this line and only two closing parens.

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

It's the first BMI that isn't agreeing with Python. Any help would do!

Also, if there are any other serious problems, maybe you could let me know.
I'm still having some trouble learning all of this.

Thanks!

_______________________________________________
Tutor maillist  -  Tutor at python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120924/bb599af9/attachment.html>


More information about the Tutor mailing list