Complete the code to define the cancellation status in the policy class.
class CancellationPolicy: def __init__(self): self.status = '[1]'
The cancellation policy starts with an 'active' status indicating it is valid.
Complete the method to check if a refund is allowed based on the policy status.
def can_refund(self): return self.status == '[1]'
Refunds are allowed only if the policy status is 'cancelled'.
Fix the error in the refund calculation method to correctly compute refund amount.
def calculate_refund(self, amount): if self.status == 'cancelled': return amount [1] 0.8 else: return 0
The refund is 80% of the amount, so multiplication by 0.8 is correct.
Fill both blanks to complete the policy update method that sets status and logs the change.
def update_policy(self, new_status): self.status = [1] print('Policy status changed to', [2])
The status is updated to the variable new_status, and the current status is printed.
Fill all three blanks to complete the refund eligibility check with time and status conditions.
def is_refund_eligible(self, days_since_purchase): return self.status == [1] and days_since_purchase [2] [3]
Refund is eligible if status is 'cancelled' and purchase was within 30 days.