What is your name?
Your name is saathvik
['cheeta', 'elephant', 'dog', 'cat', 'chicken']
{'first_name': 'saathvik', 'last_name': 'Gampa', 'age': 'fifteen', 'school': 'DNHS'}
saathvik
Gampa
fifteen
DNHS
How much points did you get on your test?
How many points was the test out of?
Your percentage is 75.0%
# Define the Recipe class to store details about a recipe
class Recipe:
# Constructor to initialize a Recipe object
def __init__(self, name, ingredients, instructions):
self.name = name
self.ingredients = ingredients
self.instructions = instructions
# Method to display the recipe details
def display(self):
print(f"Recipe Name: {self.name}")
print("\nIngredients:")
for ingredient in self.ingredients:
print(f"- {ingredient}")
print("\nInstructions:")
for instruction in self.instructions:
print(f"- {instruction}")
# Function to search for a recipe by name from a list of recipes
def find_recipe(name, recipes):
for recipe in recipes:
if recipe.name.lower() == name.lower():
return recipe
return None
# Function to delete a recipe by name from a list of recipes
def delete_recipe(name, recipes):
for index, recipe in enumerate(recipes):
if recipe.name.lower() == name.lower():
del recipes[index]
return True
return False
# List to store all the recipes
recipes = []
# Main loop for the Recipe Book Manager
while True:
print("\nWelcome to the Recipe Book Manager")
print("Select your action")
print("A: Add a recipe \nB. View a Recipe \nC. Delete a Recipe \nD. Exit")
choice = input("Your Choice: ").upper()
# Add a new recipe
if choice == "A":
recipe_name = input("Enter the name of the recipe: ")
ingredients = []
while True:
ingredient = input("Add an ingredient (or type 'done' to finish): ")
if ingredient.lower() == 'done':
break
ingredients.append(ingredient)
instructions = []
while True:
instruction = input("Enter the process/instructions for the recipe (Type 'done' to finish): ")
if instruction.lower() == "done":
break
instructions.append(instruction)
new_recipe = Recipe(recipe_name, ingredients, instructions)
recipes.append(new_recipe)
print("Recipe added successfully!")
new_recipe.display()
# View a specific recipe
elif choice == "B":
recipe_name = input("Enter the name of the recipe you want to view: ")
recipe = find_recipe(recipe_name, recipes)
if recipe:
recipe.display()
else:
print("Recipe not found!")
# Edit or Delete a specific recipe
elif choice == "C":
action = input("Would you like to Edit (E) or Delete (D) a recipe? ").upper()
if action == "D":
recipe_name = input("Enter the name of the recipe you want to delete: ")
if delete_recipe(recipe_name, recipes):
print("Recipe deleted successfully!")
else:
print("Recipe not found!")
# Exit the Recipe Book Manager
elif choice == "D":
print("Goodbye!")
break
Welcome to the Recipe Book Manager
Select your action
A: Add a recipe
B. View a Recipe
C. Delete a Recipe
D. Exit
Your Choice: A
Enter the name of the recipe: apple pie
Add an ingredient (or type 'done' to finish): apples
Add an ingredient (or type 'done' to finish): oven
Add an ingredient (or type 'done' to finish): dough
Add an ingredient (or type 'done' to finish): done
Enter the process/instructions for the recipe (Type 'done' to finish): 1. bake oven
Enter the process/instructions for the recipe (Type 'done' to finish): 2nd eat
Enter the process/instructions for the recipe (Type 'done' to finish): done
Recipe added successfully!
Recipe Name: apple pie
Ingredients:
- apples
- oven
- dough
Instructions:
- 1. bake oven
- 2nd eat
Welcome to the Recipe Book Manager
Select your action
A: Add a recipe
B. View a Recipe
C. Delete a Recipe
D. Exit
Your Choice: b
Enter the name of the recipe you want to view: apple pie
Recipe Name: apple pie
Ingredients:
- apples
- oven
- dough
Instructions:
- 1. bake oven
- 2nd eat
Welcome to the Recipe Book Manager
Select your action
A: Add a recipe
B. View a Recipe
C. Delete a Recipe
D. Exit
Your Choice: c
Would you like to Edit (E) or Delete (D) a recipe? apple pie
Welcome to the Recipe Book Manager
Select your action
A: Add a recipe
B. View a Recipe
C. Delete a Recipe
D. Exit
Your Choice: b
Enter the name of the recipe you want to view: apple pie
Recipe Name: apple pie
Ingredients:
- apples
- oven
- dough
Instructions:
- 1. bake oven
- 2nd eat
Welcome to the Recipe Book Manager
Select your action
A: Add a recipe
B. View a Recipe
C. Delete a Recipe
D. Exit
Your Choice: c
Would you like to Edit (E) or Delete (D) a recipe? apple pie
Welcome to the Recipe Book Manager
Select your action
A: Add a recipe
B. View a Recipe
C. Delete a Recipe
D. Exit
Your Choice: c
Would you like to Edit (E) or Delete (D) a recipe? d
Enter the name of the recipe you want to delete: apple pie
Recipe deleted successfully!
Welcome to the Recipe Book Manager
Select your action
A: Add a recipe
B. View a Recipe
C. Delete a Recipe
D. Exit
Your Choice: b
Enter the name of the recipe you want to view: apple pie
Recipe not found!
Welcome to the Recipe Book Manager
Select your action
A: Add a recipe
B. View a Recipe
C. Delete a Recipe
D. Exit
Your Choice: d
Goodbye!
Recipe added successfully!
Recipe Name: apple
Ingredients:
- idk
- idk
- idk
Instructions:
- cap
- cap
Welcome to the Recipe Book Manager
Select your action
A: Add a recipe
B. View a Recipe
C. Delete a Recipe
D. Exit
Your Choice: b
Enter the name of the recipe you want to view: apple
Recipe Name: apple
Ingredients:
- idk
- idk
- idk
Instructions:
- cap
- cap
Welcome to the Recipe Book Manager
Select your action
A: Add a recipe
B. View a Recipe
C. Delete a Recipe
D. Exit
Your Choice: c
Would you like to Edit (E) or Delete (D) a recipe? D
Enter the name of the recipe you want to delete: apple
Recipe deleted successfully!
Welcome to the Recipe Book Manager
Select your action
A: Add a recipe
B. View a Recipe
C. Delete a Recipe
D. Exit
Your Choice: b
Enter the name of the recipe you want to view: apple
Recipe not found!
Welcome to the Recipe Book Manager
Select your action
A: Add a recipe
B. View a Recipe
C. Delete a Recipe
D. Exit