Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.67 KB | None | 0 0
  1. def bmi_calculator():
  2. print "Press 1 to use pounds and inches"
  3. print "Press 2 to use kilograms and meters"
  4. measuresystem=raw_input()
  5. print ""
  6. if measuresystem == "1":
  7. print "What is your height in inches"
  8. height = float(raw_input())
  9. print ""
  10. print "What is your weight in pounds"
  11. weight = float(raw_input())
  12. print ""
  13. bmi = (weight * 703) / (height**2)
  14. print 'Your bmi is %.2f' %bmi
  15. elif measuresystem == "2":
  16. print "What is your height in meters"
  17. height = float(raw_input())
  18. print ""
  19. print "What is your weight in kilograms"
  20. weight = float(raw_input())
  21. print ""
  22. bmi = (weight / (height**2))
  23. print 'Your bmi is %.2f' %bmi
  24. else:
  25. print "Please choose a valid number"
  26.  
  27. if bmi >= 40:
  28. print "Category: Morbidly Obese"
  29. elif bmi >=35:
  30. print "Category: Severely Obese"
  31. elif bmi >= 30:
  32. print "Category: Moderately Obese"
  33. elif bmi >= 25:
  34. print "Category: Overweight"
  35. elif bmi >= 18.5:
  36. print "Category: Normal Weight"
  37. elif bmi >= 16.1:
  38. print "Category: Underweight"
  39. elif bmi >= 15:
  40. print "Category: Severely Underweight"
  41. else:
  42. print "Category: Extremely Underweight"
  43. rerunbmi()
  44.  
  45. def rerunbmi():
  46. print ""
  47. print "Would you like to enter in new metrics for a new result?"
  48. answer1 = raw_input()
  49. if answer1 == "no":
  50. print ""
  51. print "Ok,hope to see you soon!"
  52. elif answer1 == "yes":
  53. print ""
  54. else:
  55. print "Please answer yes or no"
  56. rerunbmi()
  57.  
  58. bmi_calculator()
  59.  
  60.  
  61. def magic_8ball():
  62. print "MAGIC 8 BALL SAYS: What is your question?"
  63. print ""
  64. question = raw_input()
  65. answers = ["It is ceartin.","It is decidedly so.","Without a doubt.","Yes,definitly.","You may rely on it.",
  66. "As I see it,yes.","Most likely.","Outlook good.","Yes","Signs point to yes.",
  67. "Reply hazy, try again.","Ask again later.","Better not tell you now.","Cannot predict now.","Concentrate and ask again",
  68. "Don't count on it.","My reply is no.","My sources say no.","Outlook not so good.","Very doubtful."]
  69. import random
  70. print random.choice(answers)
  71. print ""
  72. rerunball()
  73.  
  74. def rerunball():
  75. print ""
  76. print "MAGIC 8 BALL SAYS: Do you have another question?"
  77. answer1 = raw_input()
  78. if answer1 == "no":
  79. print "Goodbye Mortal"
  80. elif answer1 == "yes":
  81. print ""
  82. magic_8ball()
  83. else:
  84. print "Please anwer yes or no"
  85. rerunball()
  86.  
  87.  
  88.  
  89. magic_8ball()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement