Implement bill_for(month, plan, users) to calculate the monthly bill for a customer.
The bill depends on how many users are active during the given month. A user contributes to the bill for each day they are active in that month.
You are given:
month: a string like'2019-01'plan: a dictionary containing the customer id and monthly price in dollarsusers: a list of user dictionaries with activation and deactivation dates
A user is considered active on a day if they have been activated and have not yet been deactivated.
Examples:
- When the customer has no active users during the month, the bill is
0.00. - When everything stays the same for a month, the bill is
8.00. - When a user is activated during the month, the bill is
10.84.
This problem asks you to compute a customer’s monthly bill by counting user activity day by day within the target month. The key is to treat each user as an active interval and check whether that interval covers each date in the month, including edge cases such as activation mid-month, no active users, and users still active at month end. A straightforward date-iteration approach with careful boundary handling is enough to produce the expected floating-point bill.