Feature Flags by Plan

Easy ⏱ 8 min 89% acceptance ★★★★★ 4.7
Plans nest: free ⊂ pro ⊂ enterprise. Write can_use(plan, feature) given the entitlement map — free: export_csv; pro adds api_access, custom_reports; enterprise adds sso, audit_log. Higher plans include everything below. Return a boolean.

Examples

Example 1
Input
can_use('pro', 'export_csv')
Output
True
Explanation

Pro inherits every free feature.

Example 2
Input
can_use('pro', 'sso')
Output
False
Explanation

SSO is enterprise-only.

Constraints

  • Model inheritance, not copy-pasted lists.
  • Unknown plans have no features.

Topics

Business Logicentitlements

Companies

AtlassianNotionCanva

Hints

Hint 1

An ordered list of (plan, features) lets you accumulate.

Hint 2

Union sets up to the requested plan.

Loading the Python runtime… Run executes your code and shows printed output; Submit checks your function against this problem's examples.