Skip to content

Commit ab971a7

Browse files
Add Vegan Recipe Randomizer - Fixes sumanth-0#623
This PR adds a Vegan Recipe Randomizer that generates random vegan recipes for plant-based meal inspiration. Features: - 10 pre-set vegan recipes with ingredients, time, and difficulty - Random recipe selection - Filter by difficulty (Easy/Medium) - Filter by quick recipes (<25 min) - Interactive menu system - Well-commented code under 100 lines Fixes sumanth-0#623
1 parent d109d1a commit ab971a7

1 file changed

Lines changed: 83 additions & 0 deletions

File tree

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Vegan Recipe Randomizer - Generates random vegan recipes for plant-based meal inspiration.
4+
For the days when you want plants, but make it fancy!
5+
"""
6+
import random
7+
from typing import Dict, List
8+
9+
# Pre-set collection of delicious vegan recipes
10+
VEGAN_RECIPES = [
11+
{"name": "Creamy Coconut Curry", "ingredients": ["coconut milk", "chickpeas", "spinach", "curry paste", "rice"], "time": "30 min", "difficulty": "Easy"},
12+
{"name": "Buddha Bowl Supreme", "ingredients": ["quinoa", "roasted chickpeas", "avocado", "tahini", "kale"], "time": "25 min", "difficulty": "Easy"},
13+
{"name": "Spicy Black Bean Tacos", "ingredients": ["black beans", "corn tortillas", "avocado", "salsa", "cilantro"], "time": "20 min", "difficulty": "Easy"},
14+
{"name": "Mushroom Stroganoff", "ingredients": ["mushrooms", "cashew cream", "pasta", "garlic", "thyme"], "time": "35 min", "difficulty": "Medium"},
15+
{"name": "Thai Peanut Noodles", "ingredients": ["rice noodles", "peanut butter", "vegetables", "soy sauce", "lime"], "time": "20 min", "difficulty": "Easy"},
16+
{"name": "Lentil Shepherd's Pie", "ingredients": ["lentils", "mashed potatoes", "carrots", "peas", "vegetable broth"], "time": "50 min", "difficulty": "Medium"},
17+
{"name": "Vegan Pad Thai", "ingredients": ["rice noodles", "tofu", "peanuts", "bean sprouts", "tamarind sauce"], "time": "25 min", "difficulty": "Medium"},
18+
{"name": "Mediterranean Hummus Bowl", "ingredients": ["hummus", "quinoa", "cucumber", "tomatoes", "olives"], "time": "15 min", "difficulty": "Easy"},
19+
{"name": "Sweet Potato Buddha Bowl", "ingredients": ["sweet potato", "chickpeas", "quinoa", "tahini", "spinach"], "time": "30 min", "difficulty": "Easy"},
20+
{"name": "Vegan Chili", "ingredients": ["kidney beans", "tomatoes", "bell peppers", "corn", "chili powder"], "time": "40 min", "difficulty": "Easy"}
21+
]
22+
23+
def display_recipe(recipe: Dict) -> None:
24+
"""Display a recipe in a formatted manner."""
25+
print(f"\n{'='*50}\n🌱 {recipe['name']} 🌱\n{'='*50}")
26+
print(f"⏱️ Time: {recipe['time']} | 📊 Difficulty: {recipe['difficulty']}")
27+
print(f"\n🥗 Ingredients:")
28+
for ingredient in recipe['ingredients']:
29+
print(f" • {ingredient}")
30+
print("="*50 + "\n")
31+
32+
def get_random_recipe() -> Dict:
33+
"""Return a random vegan recipe from the collection."""
34+
return random.choice(VEGAN_RECIPES)
35+
36+
def get_recipes_by_difficulty(difficulty: str) -> List[Dict]:
37+
"""Filter recipes by difficulty level."""
38+
return [r for r in VEGAN_RECIPES if r['difficulty'].lower() == difficulty.lower()]
39+
40+
def get_quick_recipes(max_time: int = 25) -> List[Dict]:
41+
"""Get recipes that can be made within specified time."""
42+
return [r for r in VEGAN_RECIPES if int(r['time'].split()[0]) <= max_time]
43+
44+
def main():
45+
"""Main function to run the Vegan Recipe Randomizer."""
46+
print("\n🌿 Welcome to the Vegan Recipe Randomizer! 🌿")
47+
print("For the days when you want plants, but make it fancy!\n")
48+
49+
while True:
50+
print("\nOptions:")
51+
print("1. Random recipe")
52+
print("2. Random easy recipe")
53+
print("3. Random medium recipe")
54+
print("4. Quick recipe (<25 min)")
55+
print("5. Show all recipes")
56+
print("6. Exit")
57+
58+
choice = input("\nChoice (1-6): ").strip()
59+
60+
if choice == '1':
61+
display_recipe(get_random_recipe())
62+
elif choice == '2':
63+
easy = get_recipes_by_difficulty('Easy')
64+
if easy: display_recipe(random.choice(easy))
65+
elif choice == '3':
66+
medium = get_recipes_by_difficulty('Medium')
67+
if medium: display_recipe(random.choice(medium))
68+
elif choice == '4':
69+
quick = get_quick_recipes()
70+
if quick: display_recipe(random.choice(quick))
71+
else: print("\n❌ No quick recipes found.")
72+
elif choice == '5':
73+
print(f"\n📋 Total Recipes: {len(VEGAN_RECIPES)}")
74+
for i, r in enumerate(VEGAN_RECIPES, 1):
75+
print(f"{i}. {r['name']} ({r['time']}, {r['difficulty']})")
76+
elif choice == '6':
77+
print("\n🌱 Happy cooking! Stay plant-powered! 🌱\n")
78+
break
79+
else:
80+
print("\n❌ Invalid choice. Try again.")
81+
82+
if __name__ == "__main__":
83+
main()

0 commit comments

Comments
 (0)