if codecc_populations[codepopulation wm pygal worldmap(wm title 'world population in by countryx wm add(' 'cc_populationswm render_to_file('world_population svg'we first import pygal at we create an empty dictionary to store country codes and populations in the format pygal expects at we build the cc_populations dictionary using the country code as key and the population as the value whenever code is returned we also remove all the print statements we make worldmap instance and set its title attribute when we call add()we pass it the dictionary of country codes and population values figure - shows the map that' generated figure - the world' population in we don' have data for few countrieswhich are colored in blackbut most countries are colored according to their population size you'll deal with the missing data later in this but first we'll alter the shading to more accurately reflect the population of the countries currentlyour map shows many lightly shaded countries and two darkly shaded countries the contrast between most of the countries isn' enough to indicate how populated they are relative to each other we'll fix this by grouping countries into population levels and shading each group