All problems

How Many Cities Have Riders Signed Up?

easyPythonBasics

UrbanHop's expansion team reviews how far the rider base has spread, and the review always starts from a date: how many distinct cities have picked up a rider since then? An older start date takes in more of the history, while a recent one asks whether the last few weeks reached anywhere at all.

Riders

id name city signup_date
1 Maya Chen Austin 2023-01-05
2 Noah Patel Denver 2023-02-14
3 Zara Ahmed Austin 2023-03-01
4 Leo Kim Seattle 2023-04-20
5 Ivy Brooks Denver 2023-05-11

Input

The riders table above is already built for you — those rows are not read from input. What does arrive is a single line holding the start date of the review, written the same way signup_date writes its dates.

Task: Print how many distinct cities appear among riders whose signup_date falls on or after that date. If nobody signed up in that window, print 0.

Example: if the riders in the window came from seven cities, you'd print 7.

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…