I cant figure out what arguements to use or really even what arguements are.

#Template for Program 2
#The keyword "pass" is a placeholder that does nothing
#Move each line of original code into the appropriate module
#Add arguments to calcBMI() and displayResults() as needed

#original code -- not in modules yet
#cut and paste into appropriate modules below


#revised code broken into modules
#delete "pass" once you add code to a module
#don't forget to indent
def main():
    print("Body Mass Index (BMI) Program")
    print()
    weight = float(input("Enter your weight in pounds: "))
    height = float(input("Enter your height in inches: "))
    calcBMI()

def calcBMI():
    bmi = (weight * 703)/(height * height)
    displayResults()


def displayResults(bmi):
    print()
    print("Your BMI is:", bmi)

#Call the main function to get things started

main()

Greetings:

First and foremost, I warmly applaud your efforts to learn Python.

That being said, arguments in Python are parameters(or local variables) that are passed(or given) to a function to work with.

Your calcBMI function is currently not set-up to receive any parameters. Also, it's a better programming practice to let your main function execute all of the functions in your program. Here's a fix:

def main():
    print("Body Mass Index (BMI) Program")
    print()
    weight = float(input("Enter your weight in pounds: "))
    height = float(input("Enter your height in inches: "))
    bmi = calcBMI(weight, height)
    displayResults(bmi)

def calcBMI(weight, height):
    return (weight * 703) / (height * height)

def displayResults(bmi):
    print()
    print("Your BMI is:", bmi)

if __name__ == "__main__":
    main()
commented: Nice answer :) +15

Thank you!!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.