Youngest bike rider from sample_training.trips -- incorrect solution

The posted solution yields the correct answer, however the solution is not correct because it does not consider the start time.

To find the YOUNGEST, the rider’s AGE must be calculated as the difference between ‘start time’ and ‘birth year’.

Because the start time happens to be 2016 for ALL entries (which is obviously incorrect and unrealistic), the posted solution works.

However if the start time was realistic, a rider born in a different year could be younger than a 16-year-old rider starting a ride in 2016.
For example a rider born in 1885 might have a start time of 1895-01-01 instead of 2016-01-01 and thus be 9 or 10 years old.

I will leave it as an exercise for people to find the true solution, but I wonder if the course authors should find a better example quiz question or revise the wording.

The Quiz question would work if it was qualified with an assumption, for example:
(Assuming all rides were started in 2016) In what year was the youngest bike rider from the sample_training.trips collection born?

:wave: Hi @Howard_Berg,

Welcome to the MongoDB Community Forum :star2:

Sorry but I couldn’t understand your point, why would we calculate the age by subtracting the birth year from start time.

As per my understanding birth year has no co-relation with start time.

Could you please elaborate more on this and help me to understand your perspective.

For reference, I’m attaching the screenshot of the trips collection :point_down:

Regards,
Kushagra

Hi,

You are correct that the birth year has no correlation with start time, but the age does.

The age of a person is always calculated relative to a particular date and cannot be determined unless there is some other date with which to compare.

In the problem, the only logical comparison date is the date that the rider started riding the bike. In the data supplied with the problem, the start date happens to be January 1st 2016 for every trip. But a true data set would have trips that start on other days in other months and other years. And the age of the rider would depend upon both the birth date and the date they started the trip.

Imagine if a rider born in 1993 started a bike ride in 2005 (instead of 2016). Their age would be 12, and so they would be younger than someone born in 1999 who started a bike ride in 2016.

Hi @Howard_Berg,

Thanks for the elaboration of your point. I got your context and will revise the wording of the question!

Thanks,
Kushagra

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.