BMI calculator in Python This is my first attempt at writing a programme: a BMI calculator written in Python. Please give me feedback on the programme overall, as well as how easy the code is to interpret and adapt.

from sys import exit

bmi = ["what is bmi?", "what is bmi", "bmi", "bmi?"]

male=["male","m"]

female=["female", "f"]

def bmi_q():
    print "Very good! Let's start with your age."
    age= float(raw_input("How old are you %s?   &gt;   " %name))

    height= float(raw_input("How tall are you, in m?    &gt;   "))

    weight=float(raw_input("What do you weigh in kg?    &gt;   "))
    Gender=raw_input("Finally, are you male or female? (No offense.)    &gt;   ")

    result = bmi_c(weight,height)

    analysis(result)

def analysis(result):
    if result &lt; 18.5:
        print "Your BMI is %d." % round(result,2), "You are far too skinny, please eat more." 
        print "A healthy BMI is between 18.5 and 25."
        exit(0)

    elif result &gt; 25:
        print "Your BMI is %d." % round(result,2), "You are far too fat, please eat less." 
        print "A healthy BMI is between 18.5 and 25."
        exit(0)

    else:
        print "Your BMI is %d." % round(result,2), "Congratulations! You're well fit."
        print "A healthy BMI is between 18.5 and 25."
        exit(0)

def bmi_c(weight,height):
    return weight / (height**2)

def consent_q():    
    unsure = True

    while True:
        print "Would you like to calculate your BMI?" 
        consent = raw_input("&gt; Answer: \"Yes\", \"No\", or \"What is BMI?\" &gt;   ")

        if consent.lower() == "no":
            print ("What did you open a script called \"BMI\" for then??? This is all I can do!")

        elif consent.lower() in bmi:
            print """Wise man at CDC say: 
                \"Body Mass Index (BMI) is a person's weight in kilograms 
                divided by the square of height in meters. 

                A high BMI can be an indicator of high body fatness. 

                BMI can be used to screen for weight categories that may 
                lead to health problems but it is not diagnostic of the 
                body fatness or health of an individual.\" """

        elif consent.lower() == "yes":
            unsure = False
            bmi_q()

        else:
            print "Sorry, me no hablo ingles so good. Try again."


print "Thank you for running the BMI script." 
print "Before we begin, please tell me your name:"
name=raw_input("&gt;   ")
print "Hello %s, nice to meet you." % (name)
consent_q()
The main issue I see is inconsistent style. Sometimes you put spaces around certain operators, sometimes you don't. You want your code to be consistently formatted.

Generally, it's best to always put a space before and after an operator, especially the assignment operator. It's even more strange to put a space before an operator, but not after (or vice versa).

This line, for example:

age= float(raw_input("How old are you %s?   &gt;   " %name))


would look much better like this:

age = float(raw_input("How old are you %s?   &gt;   " % name))


You also switch between putting a space after commas in lists, and not doing so. I would change these lines:

male=["male","m"]

female=["female", "f"]


to look like this (notice the space after the first comma):

male = ["male", "m"]

female = ["female", "f"]


Variables should always begin with a lowercase letter. Classes and constants can and should be capitalized, but not normal variables. So the Gender variable should be renamed to gender.

You should consider not asking for the user's gender and age unless you actually do something with that data, or at least don't assign it to variables because it'll go unused.

I would also rename bmi_q, bmi_c, and consent_q to something more clear, so other people reading your code can immediately know what those function are supposed to do. bmi_c could definitely be renamed to something like calculate_bmi, or even calc_bmi.

And lastly, I'd always make sure your indention doesn't get messed up when pasting your code into a site like this. There's a few problems with invalid indention, but I'd imaging that happened when you put it in this question. (the indention in the question has been fixed now though)

But overall, good job on writing your first program! Congrats, keep it up, and remember this quote from Phil Karlton: 


  There are only two hard things in Computer Science: cache invalidation and naming things.