Message Boards Message Boards

0
|
8428 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:
GROUPS:

"every city in the world whose population exceeds that of australia"

Posted 10 years ago

How do I compose the question so that I get something more than just the population of Australia?

POSTED BY: Bruce Axtens
2 Replies
Posted 10 years ago

You can use the follows code to get it, If you don't care about which year the data is.

But you may wait for a long time.

AllCitys = CityData[];
AustraliaP = CityData["AustraliaP", "Population"];
ACP = {#, CityData[#, "Population"]} & /@ AllCitys;
Select[ACP, #[[1]] > AustraliaP &][[;; , 1]]
POSTED BY: Xuan Li

Dear Xuan: I had to make small changes in your code, because I was unable to get it to work. It appears that there is no city in world more populous than Australia. So I tryed with Panama and I found 180 cities.

AllCitys = CityData[];
PanamaP = CountryData["Panama", "Population"];
ACP = {#, CityData[#, "Population"]} & /@ AllCitys;
ACP1 = DeleteCases[ACP, {_, x_} /; MatchQ[Head[x], Missing] == True];
Select[ACP1, #[[2]] > PanamaP &][[;; , 1]]
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract