Guest User

Untitled

a guest
Nov 18th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. # U07_Ex05_BMI.py
  2. #
  3. # Author: David Hanft
  4. # Course: Coding for OOP
  5. # Section: A3
  6. # Date: 13 Nov 2017
  7. # IDE: Python 3.6.2
  8. #
  9. # Assignment Info
  10. # Exercise: 5
  11. # Source: Python Programming
  12. # Chapter: 7
  13. #
  14. # Program Description
  15. # This program calculates a persons BMI and tells them if they are above, within
  16. # or below the healthy range
  17. #
  18. # Algorithm (pseudocode)
  19. # def main():
  20. # input for weight (lbs)
  21. # input for height (in)
  22. # run calc
  23. # print status
  24. # def calc():
  25. # BMI = (weight*720)/(height**2)
  26. # if BMI >= 19 and BMI <= 25
  27. # return within
  28. # if BMI < 19
  29. # retrun below
  30. # if BMI > 25
  31. # return above
  32. def main():
  33. weight = int(input('\nInput your weight(lbs): '))
  34. height = int(input('\nInput your height(in): '))
  35. calc(weight,height)
  36. status = calc(weight,height)
  37. print('\nYour BMI is currently', status, 'the healthy range')
  38. def calc(weight,height):
  39. BMI = (weight*720)/(height**2)
  40. # Seeing where BMI falls in or outside the range and assigning the appropriate
  41. # status according to the 19-25 healthy range
  42. if BMI >= 19 and BMI <=25:
  43. status = 'within'
  44. elif BMI < 19:
  45. status = 'below'
  46. elif BMI > 25:
  47. status = 'above'
  48. return status
  49. if __name__ == '__main__':
  50. main()
Add Comment
Please, Sign In to add comment