Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # U07_Ex05_BMI.py
- #
- # Author: David Hanft
- # Course: Coding for OOP
- # Section: A3
- # Date: 13 Nov 2017
- # IDE: Python 3.6.2
- #
- # Assignment Info
- # Exercise: 5
- # Source: Python Programming
- # Chapter: 7
- #
- # Program Description
- # This program calculates a persons BMI and tells them if they are above, within
- # or below the healthy range
- #
- # Algorithm (pseudocode)
- # def main():
- # input for weight (lbs)
- # input for height (in)
- # run calc
- # print status
- # def calc():
- # BMI = (weight*720)/(height**2)
- # if BMI >= 19 and BMI <= 25
- # return within
- # if BMI < 19
- # retrun below
- # if BMI > 25
- # return above
- def main():
- weight = int(input('\nInput your weight(lbs): '))
- height = int(input('\nInput your height(in): '))
- calc(weight,height)
- status = calc(weight,height)
- print('\nYour BMI is currently', status, 'the healthy range')
- def calc(weight,height):
- BMI = (weight*720)/(height**2)
- # Seeing where BMI falls in or outside the range and assigning the appropriate
- # status according to the 19-25 healthy range
- if BMI >= 19 and BMI <=25:
- status = 'within'
- elif BMI < 19:
- status = 'below'
- elif BMI > 25:
- status = 'above'
- return status
- if __name__ == '__main__':
- main()
Add Comment
Please, Sign In to add comment