Guest User

Untitled

a guest
Dec 22nd, 2019
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.73 KB | None | 0 0
  1. fruits = []
  2. meats = []
  3. dairy = []
  4. vegetables = []
  5. sauces = []
  6. sweets = []
  7.  
  8. class bcolors:
  9. HEADER = '\033[95m'
  10. OKBLUE = '\033[94m'
  11. OKGREEN = '\033[92m'
  12. WARNING = '\033[93m'
  13. FAIL = '\033[91m'
  14. ENDC = '\033[0m'
  15. BOLD = '\033[1m'
  16. UNDERLINE = '\033[4m'
  17.  
  18. # should add option to add nothing to each category
  19. # should restrict total # of items to limited amount
  20. # should add budget, each item costs certain amount
  21. # should print list of recipes you can make with added items.
  22.  
  23. print(":::Your fridge is empty.:::\n")
  24.  
  25.  
  26. def show_fridge():
  27. """Shows contents of all types currently in the fridge."""
  28. print(f"\n{bcolors.BOLD}:::::Here's everything in the fridge:::::{bcolors.ENDC}")
  29. print(f"\n{bcolors.OKBLUE}:::Fruits:::{bcolors.ENDC}")
  30. for fruit in fruits:
  31. print(fruit.title())
  32. print(f"\n{bcolors.OKBLUE}:::Vegetables:::{bcolors.ENDC}")
  33. for vegetable in vegetables:
  34. print(vegetable.title())
  35. print(f"\n{bcolors.OKBLUE}:::Meats:::{bcolors.ENDC}")
  36. for meat in meats:
  37. print(meat.title())
  38. print(f"\n{bcolors.OKBLUE}:::Dairy:::{bcolors.ENDC}")
  39. for dair in dairy:
  40. print(dair.title())
  41. print(f"\n{bcolors.OKBLUE}:::Sauces:::{bcolors.ENDC}")
  42. for sauce in sauces:
  43. print(sauce.title())
  44. print(f"\n{bcolors.OKBLUE}:::Sweets:::{bcolors.ENDC}")
  45. for sweet in sweets:
  46. print(sweet.title())
  47.  
  48.  
  49. def add_something_fridge(list_fruit, list_meat, list_veg, list_dairy, list_sauce, list_sweet):
  50. condition = True
  51. while condition:
  52. food_choice = input(
  53. "Please specify the food category you'll be storing in the fridge from the following options:\n"
  54. "[F] for fruits\n"
  55. "[M] for meats\n"
  56. "[V] for vegetables\n"
  57. "[D] for dairy\n"
  58. "[S] for sauces\n"
  59. "[C] for candies & sweets\n"
  60. "[Q] to exit\nSpecify here: ")
  61.  
  62. a_list = []
  63. specifier = ''
  64. if food_choice.upper() == 'Q':
  65. break
  66.  
  67. if food_choice.upper() == 'F':
  68. specifier = 'fruits'
  69. a_list = list_fruit
  70. elif food_choice.upper() == 'M':
  71. specifier = 'meat'
  72. a_list = list_meat
  73. elif food_choice.upper() == 'V':
  74. specifier = 'vegetables'
  75. a_list = list_veg
  76. elif food_choice.upper() == 'D':
  77. specifier = 'dairy products'
  78. a_list = list_dairy
  79. elif food_choice.upper() == 'S':
  80. specifier = 'sauces'
  81. a_list = list_sauce
  82. elif food_choice.upper() == 'C':
  83. specifier = 'sweets'
  84. a_list = list_sweet
  85. else:
  86. print(f'Sorry but {food_choice} is not one of the avaliable choices. Please try again.')
  87.  
  88. while condition:
  89. desired_product = input(f"What {specifier} would you like to add?: ")
  90. a_list.append(desired_product)
  91. answer = input(f"[Y/N] Would you like to add more {specifier} to the fridge?: ")
  92. if answer.upper() == 'Y':
  93. continue
  94. elif answer.upper() == 'N':
  95. break
  96.  
  97. while condition:
  98. more_food_choice = input("[Y/N] Would you like to add add a different type of food product?: ")
  99. if more_food_choice.upper() == 'Y':
  100. break
  101. elif more_food_choice.upper() == 'N':
  102. condition = False
  103. break
  104. else:
  105. print(f"Sorry, that's not one of the options. Please try again")
  106.  
  107. return list_fruit, list_veg, list_dairy, list_sauce, list_sweet
  108.  
  109.  
  110. add_something_fridge(fruits, meats, vegetables, dairy, sauces, sweets)
  111. show_fridge()
Advertisement
Add Comment
Please, Sign In to add comment