Active Subscriptions

Easy
Filtering

Active Subscriptions

A subscription is active in month 12 when start_month <= 12 and end_month >= 12.

Return account_id, plan, monthly_fee for active accounts. Sort by account_id ascending.

Browser Engine: Evaluates PySpark DataFrame & SQL logic locally in Pyodide WebAssembly.

Input data

1 DataFrame

These DataFrames are passed to solve(spark, dfs). Access one with dfs['name'].

df.subscriptions7 rows
account_id (int)plan (string)start_month (int)end_month (int)monthly_fee (double)
1Basic169.99
2Pro31229.99
3Team61899
4Basic249.99
5Pro101029.99
6Enterprise124199
7Pro121229.99

Return these columns

account_id(int)
plan(string)
monthly_fee(double)

Column names and order must match. Sort order is specified in the question.

Browser engine
Loading Python editor…
Click Run to try the sample cases, or Submit to check the hidden cases. First run caches the browser Python engine (~8–15s once); all code stays on your device.