Guys I tried a couple of ways to solve a problem I am having. My program works well without decimal numbers.

I want to get an answer with decimal points.

So each time i type in the decimal point, there is an error. This is what I tried:

    from __future__ import  division
def bmi ():   ##  bmi = body mass index
    print " program to calculate person BMI"
    name = raw_input(" Hi welcome , what is your name ? : ")
    print " welcome %s " % name 
    weight = raw_input (" your weight(kg) : ")
    height = raw_input  ("your height (m): ")
    bmi =  int(weight)
    bmi_1 = int(height)
    if bmi/bmi_1**2 <= (25): 
        print " your ibm is : %d , you are not overweight "%(  bmi/bmi_1**2)
    elif  bmi/bmi_1**2 >= 24:
         print " your iibm is : %d  , sorry you are overweight" % (  bmi/bmi_1**2)
    else :
         print " sorry mistake, try again  "

1 Answers

0
DMellon On
float()

and

str()

Will do the trick.