# You must make sure to run all cells in sequence using shift + enter or you might encounter errors
from pykubegrader.initialize import initialize_assignment

responses = initialize_assignment("5_shrinkflation_q", "week_5", "readings", assignment_points = 15.0, assignment_tag = 'week5-readings')

# Initialize Otter
import otter
grader = otter.Notebook("5_shrinkflation_q.ipynb")

โ“ Shrinkflation Function Scope#

# Run this block of code by pressing Shift + Enter to display the question
from questions._5_shrinkflation_q import Question1
Question1().show()
# Run this block of code by pressing Shift + Enter to display the question
from questions._5_shrinkflation_q import Question2
Question2().show()
# Run this block of code by pressing Shift + Enter to display the question
from questions._5_shrinkflation_q import Question3
Question3().show()

Question 1 (Points: 6.0): Calculate the Shrinkflation Price#

Write a Python function named adjust_price that:

  • Accepts two arguments: original_price (float) and shrink_factor (float).

  • Calculates the adjusted price by multiplying original_price by shrink_factor.

  • Returns the adjusted price. Ensure that the function uses local variables only and does not rely on any global variables.

...

print(adjust_price(10.0, 0.8)) # Should print 8.0
grader.check("Shrinkflation-Price")

Submitting Assignment#

Please run the following block of code using shift + enter to submit your assignment, you should see your score.

from pykubegrader.submit.submit_assignment import submit_assignment

submit_assignment("week5-readings", "5_shrinkflation_q")