Advertisement
Seikavx

hydration meter

Nov 28th, 2024
8
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.69 KB | Food | 0 0
  1. #start
  2. ''' Hydration Meter '''
  3.  
  4. #staticVars
  5. MYTH_OUNCES = 64
  6. MYTH_CUPS = 8
  7.  
  8. #inputVars
  9. dailyCups = int(input("How many cups of water do you drink per day? "))
  10. cupOunces = float(input("How many ounces is a single cup? "))
  11.  
  12. #tempVars
  13. cups = 0
  14. ounces = 0
  15. h2o_level = 0
  16.  
  17. #conditionSets
  18. # 1 #
  19. if (dailyCups < MYTH_CUPS):
  20. if cupOunces < MYTH_CUPS:
  21. ounces = MYTH_OUNCES - (cupOunces * dailyCups)
  22. cups = float(f'{ounces / cupOunces:.2}')
  23. h2o_level = (f"You drink {ounces}oz less water than the daily recommended amount of {MYTH_OUNCES}oz, so you need about {cups} more {cupOunces}oz cups.")
  24. if cupOunces == MYTH_CUPS:
  25. ounces = (cupOunces * dailyCups)
  26. cups = float(f'{cupOunces / MYTH_CUPS:.2}')
  27. h2o_level = (f"You drink {ounces}oz of water which is less than {MYTH_OUNCES}oz, so you'll need to drink about {cups} more {cupOunces}oz cups.")
  28. if cupOunces > MYTH_CUPS and dailyCups * cupOunces == MYTH_OUNCES:
  29. ounces = MYTH_OUNCES
  30. h2o_level = (f"You drink {ounces}oz of water per day, which is the daily recommended amount.")
  31. else:
  32. if cupOunces > MYTH_CUPS:
  33. ounces = (cupOunces * dailyCups) - MYTH_OUNCES
  34. cups = (f'{ounces / MYTH_CUPS}')
  35. h2o_level = (f"You drink {ounces}oz more than {MYTH_OUNCES}oz, which is about {cups} cups more than the daily recommended amount of water.")
  36. # 2 #
  37. if (dailyCups == MYTH_CUPS):
  38. if cupOunces < MYTH_CUPS:
  39. ounces = MYTH_OUNCES - (cupOunces * dailyCups)
  40. cups = float(f'{ounces / MYTH_CUPS:.2}')
  41. h2o_level = (f"You drink {ounces}oz less water than the daily recommended amount of {MYTH_OUNCES}oz, so you'll need to drink about {cups} more {cupOunces}oz cups.")
  42. if cupOunces == MYTH_CUPS:
  43. ounces = (cupOunces * dailyCups)
  44. h2o_level = (f"You drink {ounces}oz of water per day, which is the daily recommended amount.")
  45. if cupOunces > MYTH_CUPS:
  46. ounces = (cupOunces * dailyCups) - MYTH_OUNCES
  47. cups = float(f'{ounces / MYTH_CUPS:.2}')
  48. h2o_level = (f"You drink {ounces}oz more than {MYTH_OUNCES}oz, which is about {cups} cups more than the daily recommended amount of water.")
  49. # 3 #
  50. if (dailyCups > MYTH_CUPS):
  51. if cupOunces < MYTH_CUPS and dailyCups * cupOunces == MYTH_OUNCES:
  52. ounces = MYTH_OUNCES
  53. h2o_level = (f"You drink {ounces}oz of water per day, which is the daily recommended amount.")
  54. elif MYTH_OUNCES > (cupOunces * dailyCups):
  55. ounces = MYTH_OUNCES - (cupOunces * dailyCups)
  56. cups = float(f'{ounces / cupOunces:.2}')
  57. h2o_level = (f"You drink {ounces}oz less water than the daily recommended amount of {MYTH_OUNCES}oz, so you'll need to drink about {cups} more {cupOunces}oz cups.")
  58. else:
  59. if cupOunces < MYTH_CUPS:
  60. ounces = (cupOunces * dailyCups) - MYTH_OUNCES
  61. cups = float(f'{ounces / cupOunces:.2}')
  62. h2o_level = (f"You drink {ounces}oz more water than the daily recommended amount of {MYTH_OUNCES}oz.")
  63. if cupOunces == MYTH_CUPS:
  64. ounces = (cupOunces * dailyCups) - MYTH_OUNCES
  65. cups = float(f'{ounces / MYTH_CUPS:.2}')
  66. h2o_level = (f"You drink {ounces}oz more than {MYTH_OUNCES}oz, which is about {cups} cups more than the daily recommended amount of water.")
  67. if cupOunces > MYTH_CUPS:
  68. ounces = (cupOunces * dailyCups) - MYTH_OUNCES
  69. cups = (f'{ounces // MYTH_CUPS}')
  70. h2o_level = (f"You drink {ounces}oz more than {MYTH_OUNCES}oz, which is about {cups} cups more than the daily recommended amount of water.")
  71. #end_conditions
  72. #totalVars
  73. TOTAL_LEVEL = h2o_level
  74.  
  75. #outPut
  76. print(f"{TOTAL_LEVEL}")
  77. #end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement