Skip to content

Commit

Permalink
Create meal_reco
Browse files Browse the repository at this point in the history
  • Loading branch information
BiigTee authored Oct 29, 2024
1 parent b906f20 commit 71111de
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions meal_reco
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Sample data structure for recipes
recipes = {
"Spaghetti Bolognese": {
"ingredients": ["spaghetti", "ground beef", "tomato sauce", "onion", "garlic"],
"dietary_restrictions": ["none"],
"meal_type": "dinner"
},
"Chicken Salad": {
"ingredients": ["chicken breast", "lettuce", "tomatoes", "cucumber", "olive oil", "lemon"],
"dietary_restrictions": ["gluten-free", "dairy-free"],
"meal_type": "lunch"
},
"Vegetable Stir Fry": {
"ingredients": ["bell peppers", "broccoli", "carrot", "soy sauce", "ginger", "garlic"],
"dietary_restrictions": ["vegan", "gluten-free"],
"meal_type": "dinner"
},
"Pancakes": {
"ingredients": ["flour", "milk", "eggs", "sugar", "baking powder", "butter"],
"dietary_restrictions": ["vegetarian"],
"meal_type": "breakfast"
}
}

def get_user_preferences():
dietary_restrictions = input("Enter your dietary restrictions (comma-separated, e.g., gluten-free, vegan): ").split(",")
available_ingredients = input("Enter available ingredients (comma-separated): ").split(",")
meal_type = input("What type of meal are you looking for (breakfast, lunch, dinner)? ").strip().lower()

return [restriction.strip() for restriction in dietary_restrictions], \
[ingredient.strip() for ingredient in available_ingredients], \
meal_type

def recommend_recipes(dietary_restrictions, available_ingredients, meal_type):
recommendations = []

for recipe, details in recipes.items():
# Check for dietary restrictions
if any(restriction in details["dietary_restrictions"] for restriction in dietary_restrictions):
continue

# Check if the recipe can be made with available ingredients
if all(ingredient in available_ingredients for ingredient in details["ingredients"]):
# Check for meal type
if details["meal_type"] == meal_type:
recommendations.append(recipe)

return recommendations

# Main program
def main():
print("Welcome to the Personalized Recipe Recommendation System!")
dietary_restrictions, available_ingredients, meal_type = get_user_preferences()

recommended_recipes = recommend_recipes(dietary_restrictions, available_ingredients, meal_type)

if recommended_recipes:
print("\nRecommended Recipes:")
for recipe in recommended_recipes:
print(f"- {recipe}")
else:
print("\nNo recipes found that match your preferences.")

if __name__ == "__main__":
main()

0 comments on commit 71111de

Please sign in to comment.