Challenge 20 Megathread

For any and all questions relating to Challenge 20 :point_down: post away!

Can anyone help me understand what the x axis on the histogram is meant to be? I found it to be confusing and wasn’t sure how to interpret it to get the answer to the first question.

1 Like

Sure, histogram just need a x-axis value to plot distribution.
The population in the dataset has hug variation in terms of numbers.
Therefore, scale x value is needed.
Here is the hint, click_me.
Once you scaled down the x-axis value, you can set the number of bins you want to see the entire distribution.
Check on x_axis value, it should be 1e7 which is one million as a based shown on the x-axis. Good luck!

3 Likes

Any hints on how to find the schema of world.db?

@DrDave Not sure if you’ll need it… the Challenge Q specifies which table to use:

Pull the data from the worldcities table in the world.db database to the pandas DataFrame

1 Like

Keep in mind that in a histogram the x-axis represents the buckets for the outcomes, and the y-axis represents the number/percentage of occurrences of that bucket.

For example:
If we are asked to show how many people in a pool are within a specific age group, the x-axis would be our age groups and the y-axis would be the number of people in those age groups. So our bins (x-axis) could be Ages 0-5, 6-10, 11-18, 19-25, etc.

1 Like

Thank you. I was getting WAY too complicated!

isn’t 1e7 = 10 million?

Assuming you’re using matplotlib, you can force the x-axis to be millions by adding this line:

plt.ticklabel_format(axis="x", style="sci", scilimits=(6,6))

3 Likes

Anyone else seeing an incorrect country in the second spot for population? The top spot shows as correct but number 2 is not.

The top spot shows as correct but number 2 is not.

What do you mean exactly? Do you mean that the dataframe table, when sorted by population size, does not give an order or population numbers that matches other lists of population sizes?

I think that’s because there are multiple ways to measure the population size of a city. For example, some lists give population size in “the city proper”, while others give the size for “the metropolitan area”. If you look at this wikipedia page, our list is very different from the one on that page when looking at population in the “city proper”, but quite similar when looking at “metropolitan area”.

Edit: If you’re asking if the “official answer” to the second question is incorrect, I’d say yes and no. It depends how you interpret the question.

  • If you interpret the 2nd question very literally (as asking “what country in the world right now has the largest population size”), then the official (accepted) answer is correct.
  • If you interpret the question as asking “in the world.db file, what country has the city with the largest population”, then I agree that the “official” (accepted) answer is incorrect.

Either way, I think the way the question is worded is misleading. @LHL this is probably a question you want to re-word in the future! :slight_smile:

1 Like

Welcome to the penultimate day of your coding challenge. Give it your best shot!

I think I had that problem too. I got maxed out on attempts and when I looked at the solution code and the multiple choice answer, the second question answer didn’t match. I took a screen shot as that seemed so weird! And even weirder, the answer on the multichoice that shows as correct was actually one I had guessed :S

Hello!

Even though I clicked the correct answer, when I submitted the answer (2nd attempt) it says that I got 0 points for this question … could a moderator (@Denverdias @caroLHL ) please check if this was an issue as a result of the website or perhaps I did click the wrong answer?

Thanks so much for the time and happy coding!

2 Likes

That’s why I was so confused. I missed the “1e7”. It is 10 million, but that makes sense given that we’re mostly worried about how the data relates to 5 million (or 0.5 of 10 million) or 10 million (1.0) to get our first answer.

I think the final statement “Which country is two most populated?” it’s the tricky part.

1 Like

I had the same issue! :confused:

I feel like many of these questions were not proofread, and judging by how I answered the question exactly and my answer is wrong, maybe no one even tried to answer the question either?

Using the data at hand you’ll get the incorrect answer. Refer to the post above where you have to literally just hit the “most populous country in the world at the moment” interpretation of the question. Don’t use their data.

I clicked the correct answer, when I submitted the answer (2nd attempt) it says that I got 0 points for this question … could a moderator (@Denverdias @caroLHL ) please check if this was an issue as a result of the website or perhaps I did click the wrong answer?

Thanks

What’s wrong with the data, and how would it lead to the wrong answer?
I ignored the typo and was able to get the right answer, using the data.