Bird
0
0

This AI meal planner code has an error:

medium📝 Analysis Q14 of 15
AI for Everyone - AI for Personal Productivity
This AI meal planner code has an error:
ingredients = ['tomato', 'lettuce']
preferences = {'vegetarian': True}
recipe = ai_suggest_recipe(ingredients, preferences)
print(recipe)

But it returns a recipe with chicken. What is the likely mistake?
AThe print statement is incorrect.
BThe ingredients list is missing chicken.
CThe AI ignored the vegetarian preference when suggesting recipes.
DThe AI cannot suggest recipes with vegetables.
Step-by-Step Solution
Solution:
  1. Step 1: Understand the inputs and expected output

    Ingredients are vegetarian; preference is vegetarian, so recipe should be vegetarian.
  2. Step 2: Identify the error cause

    AI returned chicken recipe, so it likely ignored the vegetarian preference.
  3. Final Answer:

    The AI ignored the vegetarian preference when suggesting recipes. -> Option C
  4. Quick Check:

    Vegetarian preference ignored = A [OK]
Quick Trick: Check if AI respects dietary preferences [OK]
Common Mistakes:
MISTAKES
  • Blaming ingredients list for non-vegetarian recipe
  • Thinking print statement causes wrong recipe
  • Assuming AI can't suggest vegetable dishes

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AI for Everyone Quizzes