Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
BiigTee authored Oct 29, 2024
1 parent df7d9c4 commit 9cc2d09
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions meal_planner.py.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Sample data structure for meals and their ingredients
recipes = {
"Spaghetti Bolognese": ["spaghetti", "ground beef", "tomato sauce", "onion", "garlic"],
"Chicken Salad": ["chicken breast", "lettuce", "tomatoes", "cucumber", "olive oil", "lemon"],
"Vegetable Stir Fry": ["bell peppers", "broccoli", "carrot", "soy sauce", "ginger", "garlic"],
"Pancakes": ["flour", "milk", "eggs", "sugar", "baking powder", "butter"]
}

def display_menu():
print("Available Recipes:")
for i, recipe in enumerate(recipes.keys(), 1):
print(f"{i}. {recipe}")

def select_meals():
print("\nPlan your weekly meals:")
weekly_meals = []
for day in ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]:
display_menu()
choice = int(input(f"Choose a recipe for {day} (Enter the recipe number): "))
selected_recipe = list(recipes.keys())[choice - 1]
weekly_meals.append(selected_recipe)
print(f"{day}: {selected_recipe}")
return weekly_meals

def generate_shopping_list(weekly_meals):
shopping_list = []
for meal in weekly_meals:
ingredients = recipes[meal]
for ingredient in ingredients:
if ingredient not in shopping_list:
shopping_list.append(ingredient)
return shopping_list

# Main program
def main():
weekly_meals = select_meals()
print("\nYour Weekly Meal Plan:")
for day, meal in zip(["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], weekly_meals):
print(f"{day}: {meal}")

shopping_list = generate_shopping_list(weekly_meals)
print("\nGenerated Shopping List:")
for item in shopping_list:
print(f"- {item}")

if __name__ == "__main__":
main()

0 comments on commit 9cc2d09

Please sign in to comment.