🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Exercises.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.

Project 3: Recipe Page

Python Challenge

Builds on these lessons

Step 1 of 3
Project

A Function to Scale a Recipe

Write def scale_recipe(servings, base_servings=4) returning the scaling factor. Wrapping this in a function means the same calculation works for any serving count, called wherever it's needed, instead of copy-pasted arithmetic.

🎯 Your Task

Please add the exact code shown in the light gray box below to your editor.Do not delete your previous code, just insert these new lines in the correct place!

def scale_recipe(servings, base_servings=4):
    return servings / base_servings

factor = scale_recipe(8)
print(f"Scale factor: {factor}x")