Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def main():
- print("Body Mass Index (BMI) Program")
- print()
- weight = float(input("Enter your weight in pounds: "))
- while (weight < 50 or weight > 500):
- print('ERROR: Please enter a value between 50 and 500')
- weight = float(input('Please enter a valid weight:'))
- height = float(input("Enter your height in inches: "))
- while (height < 48 or height > 100):
- print('ERROR: Please enter a value between 48 and 100')
- weight = float(input('Please enter a valid height:'))
- incalcBMI = calcBMI(weight, height)
- displayResults(incalcBMI)
- def calcBMI(weight, height):
- bmi = (weight * 703)/(height * height)
- print()
- return bmi
- def displayResults(bmi):
- print("Your BMI is:",\
- format(bmi, ",.2f"))
- if bmi >= 18.5 and bmi < 25:
- print("This person is: An optimal weight")
- elif bmi >= 25:
- print("This person is: Overweight")
- elif bmi <= 18.5:
- print("This person is: Underweight")
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement