Oct-23-2017, 01:23 AM
I've created a BMI Index in python for a class I'm in and I'm trying to get it to do a few things without any luck. What I want it to do is just ask for the input (height and weight) then print the "BMI Index" with the name and results below then add the next user and do the same. For some reason I can only get it to print each line after I enter it. Not sure what I'm supposed to do as I'm still pretty new to this. If anyone could provide some insight it would greatly be appreciated. Thanks in advance.
##########What it's doing##########
Welcome to the BMI Index Calculator.
Please begin by entering your name, or 0 to quit: John
John's BMI Profile
.................
Please enter height in inches: ##
Height: ## "Shouldn't print yet
Please enter weight in pounds: ###
Weight: ### lbs Shouldn't print yet
BMI Index: ##.#
Please begin by entering your name, or 0 to quit: Jane
Jane's BMI Profile
.................
Please enter height in inches:
##########What I want it to do##########
Welcome to the BMI Index Calculator.
Please begin by entering your name, or 0 to quit: John
Please enter height in inches: ##
Please enter weight in pounds: ###
John's BMI Profile
............................
Height: ###"
Weight: ### lbs
BMI Index:##.#
Please begin by entering the your name, or 0 to quit: Jane
Please enter height in inches: ##
Please enter weight in pounds: ###
Jane's BMI Profile
............................
Height: ###"
Weight: ### lbs
BMI Index:##.#
Please begin by entering the your name, or 0 to quit: 0
Exiting Program...
##########What it's doing##########
Welcome to the BMI Index Calculator.
Please begin by entering your name, or 0 to quit: John
John's BMI Profile
.................
Please enter height in inches: ##
Height: ## "Shouldn't print yet
Please enter weight in pounds: ###
Weight: ### lbs Shouldn't print yet
BMI Index: ##.#
Please begin by entering your name, or 0 to quit: Jane
Jane's BMI Profile
.................
Please enter height in inches:
##########What I want it to do##########
Welcome to the BMI Index Calculator.
Please begin by entering your name, or 0 to quit: John
Please enter height in inches: ##
Please enter weight in pounds: ###
John's BMI Profile
............................
Height: ###"
Weight: ### lbs
BMI Index:##.#
Please begin by entering the your name, or 0 to quit: Jane
Please enter height in inches: ##
Please enter weight in pounds: ###
Jane's BMI Profile
............................
Height: ###"
Weight: ### lbs
BMI Index:##.#
Please begin by entering the your name, or 0 to quit: 0
Exiting Program...
def h(): height = int(input("Please enter height in inches: ")) return height def w(): weight = int(input("Please enter weight in pounds: ")) return weight def bmi(height, weight): total = float((weight * 703) / (height * height)) return total def printbmi(name): print(name + "'s BMI Profile\n .................") height = h() print("Height:", str(height), "\"") weight = w() print("Weight:", str(weight), "lbs") print("BMI Index:{0}".format(str(float(round(bmi(height, weight), 1))))) def main(name): printbmi(name) print("BMI Index Calculator.") while True: name = input("Please begin by entering the your name, or 0 to quit:") if name == "0": print("Exiting Program...") break else: main(name)