Created
December 6, 2016 21:41
-
-
Save dsomel21/08d617064c2696dc6e18cb00eb0c0268 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NOTICE THIS ISN'T ALPHABETICAL | |
dic = { | |
'Colombia': [48654392, 1090909.09, 'South America'], | |
'China': [1339190000, 9596960.00, 'Asia'] | |
} | |
target = open("save.txt", 'w') | |
# SORTED WILL MAKE IT ALPHABETICAL | |
for i in sorted(dic): | |
population = (dic[i][0]) | |
area = dic[i][1] | |
continent = dic[i][2] | |
popDensity = population/area | |
line = i,"|",continent,"|",population,"|",popDensity | |
target.write(str(line) + "\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment