CO2 Ordering Data Example output
Here is some sample output from full runs of the program. Note that each menu option described in the lab assignment page also includes sample output for that menu option.
Run showing all menu options
This is an example run showing one or more selections of each menu option. It does not show error handling of bad user input values.
% python co2_ordering.py
---------- Menu Options -----------
1. n countries w/highest CO2 in a given year (listed high to low)
2. n countries w/highest Population in a given year (high to low)
3. n countries w/highest CO2/Capita in a given year (high to low)
4. print a country's info
5. quit
Select a menu option
Enter a value between 1 and 5: 1
Enter a value for n:
Enter a value between 1 and 193: 193
Enter a year (one of 1960, 1980, 2000, 2020, 2022): 1980
The 193 largest CO2 emitters of 1980
Country Mt of CO2
----------------------------------------------------------
1. United States of America 4808.5564
2. European Union (27) 4077.5007
3. Russia 2129.1103
4. China 1494.4959
5. Germany 1100.0660
6. Japan 944.8686
7. Ukraine 674.8597
8. United Kingdom 579.0354
9. France 511.0467
10. Poland 463.3291
11. Canada 442.8469
12. Italy 386.4330
13. India 291.7111
14. Mexico 267.7438
15. Kazakhstan 230.4349
16. South Africa 228.1978
17. Spain 213.9119
18. Australia 204.3702
19. Romania 195.8066
20. Brazil 186.1907
21. Czech Republic 184.6774
22. Netherlands 176.6318
23. Saudi Arabia 169.2404
24. Belgium 134.8358
25. South Korea 134.5244
26. Iran 120.4939
27. North Korea 114.0822
28. Argentina 108.6561
29. Belarus 97.2026
30. Indonesia 94.8729
31. Venezuela 90.6406
32. Uzbekistan 89.7859
33. Hungary 86.6088
34. Bulgaria 77.2506
35. Turkey 75.2123
36. Sweden 71.7137
37. Nigeria 68.0352
38. Algeria 66.4165
39. Denmark 60.2862
40. Slovakia 59.1006
41. Finland 58.1393
42. Austria 52.0249
43. Greece 50.8887
44. Republic of Serbia 47.9812
45. Azerbaijan 46.1098
46. Iraq 45.3582
47. Egypt 45.1760
48. Colombia 44.1742
49. Switzerland 40.4906
50. Thailand 39.7175
51. Philippines 36.8686
52. United Arab Emirates 36.8234
53. Lithuania 36.4222
54. Moldova 36.4127
55. Estonia 35.3139
56. Pakistan 31.9316
57. Norway 31.7770
58. Cuba 31.3740
59. Singapore 30.4332
60. Turkmenistan 29.1418
61. Malaysia 28.0326
62. Libya 26.7806
63. Portugal 26.7735
64. Ireland 26.2715
65. Chile 25.0999
66. Kuwait 24.6162
67. Peru 24.0647
68. Latvia 23.1963
69. Israel 20.9846
70. Syria 20.7267
71. Kyrgyzstan 19.9884
72. Croatia 17.8569
73. New Zealand 17.4789
74. Trinidad and Tobago 16.9194
75. Vietnam 16.7890
76. Bosnia and Herzegovina 16.5350
77. Morocco 15.8177
78. Georgia 14.2958
79. Slovenia 13.5590
80. Ecuador 13.4072
81. Qatar 13.0817
82. Tajikistan 11.4114
83. Luxembourg 11.0736
84. Zimbabwe 9.6140
85. Tunisia 9.4956
86. Macedonia 9.1082
87. Jamaica 8.4454
88. The Bahamas 7.9721
89. Bahrain 7.8813
90. Armenia 7.7198
91. Bangladesh 7.5972
92. Brunei 6.8773
93. Mongolia 6.8552
94. Gabon 6.6247
95. Dominican Republic 6.4270
96. Kenya 6.1893
97. Oman 6.0419
98. Lebanon 5.8898
99. Uruguay 5.8185
100. Ivory Coast 5.5693
101. Myanmar 5.5088
102. Angola 5.3344
103. Albania 5.1708
104. Jordan 4.6958
105. Bolivia 4.6590
106. Guatemala 4.4926
107. Cameroon 3.8859
108. Zambia 3.5233
109. Democratic Republic of the Congo 3.4850
110. Sudan 3.4270
111. Sri Lanka 3.3886
112. Senegal 3.3364
113. Yemen 3.3135
114. Cyprus 3.2606
115. Mozambique 3.1985
116. Panama 3.1076
117. Ghana 2.4835
118. Costa Rica 2.4485
119. Suriname 2.3694
120. El Salvador 2.1194
121. Honduras 2.0380
122. Liberia 2.0376
123. Nicaragua 2.0223
124. United Republic of Tanzania 1.8736
125. Iceland 1.8618
126. Papua New Guinea 1.8283
127. Ethiopia 1.8175
128. Guyana 1.7880
129. Afghanistan 1.7563
130. Montenegro 1.6326
131. Madagascar 1.6139
132. Paraguay 1.4855
133. Malta 1.0223
134. Botswana 0.9856
135. Guinea 0.9636
136. Somalia 0.8134
137. Togo 0.7944
138. Fiji 0.7924
139. Haiti 0.7451
140. Malawi 0.7101
141. Barbados 0.6742
142. Mauritania 0.6302
143. Uganda 0.6260
144. Sierra Leone 0.6082
145. Mauritius 0.5899
146. Niger 0.5663
147. Nepal 0.5413
148. Rwanda 0.4946
149. Benin 0.4798
150. Eswatini 0.4653
151. Burkina Faso 0.4324
152. Republic of Congo 0.4055
153. Mali 0.3913
154. Djibouti 0.3481
155. South Sudan 0.3118
156. Cambodia 0.2858
157. Chad 0.2089
158. Belize 0.1905
159. Laos 0.1869
160. Liechtenstein 0.1578
161. Gambia 0.1575
162. Guinea Bissau 0.1466
163. Burundi 0.1466
164. Antigua and Barbuda 0.1429
165. Nauru 0.1246
166. Cape Verde 0.1209
167. Saint Lucia 0.1136
168. Central African Republic 0.1063
169. Solomon Islands 0.1026
170. Seychelles 0.0953
171. Samoa 0.0769
172. Vanuatu 0.0623
173. Equatorial Guinea 0.0586
174. Comoros 0.0476
175. Grenada 0.0476
176. Maldives 0.0440
177. Sao Tome and Principe 0.0403
178. Tonga 0.0403
179. Dominica 0.0366
180. Saint Vincent and the Grenadines 0.0366
181. Kiribati 0.0293
182. Bhutan 0.0220
11 of 193 countries are missing CO2 data for 1980
---------- Menu Options -----------
1. n countries w/highest CO2 in a given year (listed high to low)
2. n countries w/highest Population in a given year (high to low)
3. n countries w/highest CO2/Capita in a given year (high to low)
4. print a country's info
5. quit
Select a menu option
Enter a value between 1 and 5: 2
Enter a value for n:
Enter a value between 1 and 193: 193
Enter 1960 or 2020 for the year: 2020
The 193 Most Populous Countries of 2020
Country popluation (in millions)
-----------------------------------------------------------------
1. China 1411.1000
2. India 1380.0044
3. European Union (27) 447.4795
4. United States of America 331.5011
5. Indonesia 273.5236
6. Pakistan 220.8923
7. Brazil 212.5594
8. Nigeria 206.1396
9. Bangladesh 164.6894
10. Russia 144.0731
11. Mexico 128.9328
12. Japan 126.2610
13. Ethiopia 114.9636
14. Philippines 109.5811
15. Egypt 102.3344
16. Vietnam 97.3386
17. Democratic Republic of the Congo 89.5614
18. Turkey 84.3391
19. Iran 83.9930
20. Germany 83.1609
21. Thailand 69.8000
22. France 67.3799
23. United Kingdom 67.0810
24. United Republic of Tanzania 59.7342
25. Italy 59.4495
26. South Africa 59.3087
27. Myanmar 54.4098
28. Kenya 53.7713
29. South Korea 51.8362
30. Colombia 50.8829
31. Spain 47.3634
32. Uganda 45.7410
33. Argentina 45.3768
34. Ukraine 44.1320
35. Algeria 43.8510
36. Sudan 43.8493
37. Iraq 40.2225
38. Afghanistan 38.9283
39. Canada 38.0372
40. Poland 37.8991
41. Morocco 36.9106
42. Saudi Arabia 34.8139
43. Uzbekistan 34.2321
44. Peru 32.9718
45. Angola 32.8663
46. Malaysia 32.3660
47. Mozambique 31.2554
48. Ghana 31.0729
49. Yemen 29.8260
50. Nepal 29.1368
51. Venezuela 28.4359
52. Madagascar 27.6910
53. Cameroon 26.5459
54. Ivory Coast 26.3783
55. North Korea 25.7788
56. Australia 25.6933
57. Niger 24.2066
58. Sri Lanka 21.9190
59. Burkina Faso 20.9033
60. Mali 20.2508
61. Romania 19.2575
62. Malawi 19.1300
63. Chile 19.1162
64. Kazakhstan 18.7557
65. Zambia 18.3840
66. Ecuador 17.6431
67. Syria 17.5007
68. Netherlands 17.4415
69. Guatemala 16.8583
70. Senegal 16.7439
71. Cambodia 16.7190
72. Chad 16.4259
73. Somalia 15.8932
74. Zimbabwe 14.8629
75. Guinea 13.1328
76. Rwanda 12.9522
77. Benin 12.1232
78. Burundi 11.8908
79. Tunisia 11.8186
80. Bolivia 11.6730
81. Belgium 11.5442
82. Haiti 11.4025
83. Cuba 11.3266
84. South Sudan 11.1937
85. Dominican Republic 10.8479
86. Greece 10.7006
87. Czech Republic 10.6979
88. Sweden 10.3534
89. Portugal 10.2971
90. Jordan 10.2031
91. Azerbaijan 10.0931
92. Honduras 9.9046
93. United Arab Emirates 9.8904
94. Hungary 9.7501
95. Tajikistan 9.5376
96. Belarus 9.3800
97. Israel 9.2151
98. Papua New Guinea 8.9470
99. Austria 8.9169
100. Switzerland 8.6366
101. Togo 8.2787
102. Sierra Leone 7.9770
103. Laos 7.2756
104. Paraguay 7.1325
105. Bulgaria 6.9340
106. Republic of Serbia 6.8991
107. Libya 6.8713
108. Lebanon 6.8254
109. Nicaragua 6.6246
110. Kyrgyzstan 6.5799
111. El Salvador 6.4862
112. Turkmenistan 6.0312
113. Denmark 5.8314
114. Singapore 5.6858
115. Finland 5.5295
116. Republic of Congo 5.5181
117. Slovakia 5.4588
118. Norway 5.3795
119. Oman 5.1066
120. Costa Rica 5.0941
121. New Zealand 5.0902
122. Liberia 5.0577
123. Ireland 4.9857
124. Central African Republic 4.8298
125. Palestine 4.8033
126. Mauritania 4.6497
127. Panama 4.3148
128. Kuwait 4.2706
129. Croatia 4.0477
130. Georgia 3.7227
131. Uruguay 3.4737
132. Bosnia and Herzegovina 3.2808
133. Mongolia 3.2783
134. Armenia 2.9632
135. Jamaica 2.9612
136. Qatar 2.8811
137. Albania 2.8378
138. Lithuania 2.7949
139. Moldova 2.6205
140. Namibia 2.5409
141. Gambia 2.4167
142. Botswana 2.3516
143. Gabon 2.2257
144. Lesotho 2.1423
145. Slovenia 2.1024
146. Macedonia 2.0725
147. Guinea Bissau 1.9680
148. Latvia 1.9004
149. Bahrain 1.7016
150. Equatorial Guinea 1.4030
151. Trinidad and Tobago 1.3995
152. Estonia 1.3295
153. Timor-Leste 1.3184
154. Mauritius 1.2657
155. Cyprus 1.2074
156. Eswatini 1.1602
157. Djibouti 0.9880
158. Fiji 0.8964
159. Comoros 0.8696
160. Guyana 0.7866
161. Bhutan 0.7716
162. Solomon Islands 0.6869
163. Luxembourg 0.6304
164. Montenegro 0.6213
165. Suriname 0.5866
166. Cape Verde 0.5560
167. Maldives 0.5405
168. Malta 0.5153
169. Brunei 0.4375
170. Belize 0.3976
171. The Bahamas 0.3932
172. Iceland 0.3665
173. Vanuatu 0.3071
174. Barbados 0.2874
175. Sao Tome and Principe 0.2192
176. Samoa 0.1984
177. Saint Lucia 0.1836
178. Kiribati 0.1194
179. Federated States of Micronesia 0.1150
180. Grenada 0.1125
181. Saint Vincent and the Grenadines 0.1109
182. Tonga 0.1057
183. Seychelles 0.0985
184. Antigua and Barbuda 0.0979
185. Andorra 0.0773
186. Dominica 0.0720
187. Marshall Islands 0.0592
188. Saint Kitts and Nevis 0.0532
189. Liechtenstein 0.0381
190. Palau 0.0181
191. Tuvalu 0.0118
192. Nauru 0.0108
1 of 193 countries are missing Population data for 2020
---------- Menu Options -----------
1. n countries w/highest CO2 in a given year (listed high to low)
2. n countries w/highest Population in a given year (high to low)
3. n countries w/highest CO2/Capita in a given year (high to low)
4. print a country's info
5. quit
Select a menu option
Enter a value between 1 and 5: 3
Enter a value for n:
Enter a value between 1 and 193: 193
Enter 1960 or 2020 for the year: 1960
The 193 countries with the largest CO2/capita in 1960
Country CO2/capita ( Mtons / millions )
---------------------------------------------------------------------------
1. Luxembourg 36.6525 (11.507800 / 0.3140)
2. Kuwait 28.9823 (7.797000 / 0.2690)
3. United States of America 16.0364 (2897.315300 / 180.6710)
4. Estonia 12.1059 (14.666800 / 1.2115)
5. Germany 11.1783 (813.950200 / 72.8149)
6. United Kingdom 11.1454 (584.020000 / 52.4000)
7. Canada 10.7609 (192.716200 / 17.9090)
8. Czech Republic 10.3158 (99.052600 / 9.6020)
9. Belgium 9.9315 (90.908100 / 9.1535)
10. Kazakhstan 9.7175 (96.539200 / 9.9346)
11. Australia 8.5092 (87.444300 / 10.2765)
12. Slovakia 7.7759 (31.633200 / 4.0681)
13. Turkmenistan 7.4376 (11.924300 / 1.6033)
14. Russia 7.3776 (884.554900 / 119.8970)
15. Moldova 7.3425 (15.005700 / 2.0437)
16. Venezuela 7.0029 (57.016800 / 8.1418)
17. Iceland 6.9059 (1.212500 / 0.1756)
18. Poland 6.7339 (199.577100 / 29.6375)
19. Ukraine 6.5837 (280.891300 / 42.6646)
20. Sweden 6.5695 (49.170500 / 7.4847)
21. Denmark 6.4961 (29.749500 / 4.5796)
22. Netherlands 6.3933 (73.437600 / 11.4866)
23. France 6.3514 (296.114100 / 46.6217)
24. European Union (27) 5.8821 (2099.370900 / 356.9061)
25. South Africa 5.7219 (97.843500 / 17.0998)
26. Lithuania 5.3386 (14.833700 / 2.7786)
27. Belarus 4.9102 (40.253500 / 8.1980)
28. Azerbaijan 4.8736 (18.984500 / 3.8954)
29. New Zealand 4.8620 (11.531800 / 2.3718)
30. Hungary 4.5401 (45.328300 / 9.9840)
31. Latvia 4.5186 (9.583800 / 2.1210)
32. Austria 4.3681 (30.784500 / 7.0475)
33. Uzbekistan 4.2802 (36.493900 / 8.5263)
34. Brunei 4.0807 (0.333420 / 0.0817)
35. Ireland 3.9484 (11.168500 / 2.8286)
36. Kyrgyzstan 3.8371 (8.335400 / 2.1723)
37. The Bahamas 3.7466 (0.410370 / 0.1095)
38. Qatar 3.7117 (0.175870 / 0.0474)
39. Switzerland 3.6597 (19.498500 / 5.3278)
40. Norway 3.6543 (13.086800 / 3.5812)
41. Bahrain 3.5415 (0.575250 / 0.1624)
42. Finland 3.4059 (15.086900 / 4.4296)
43. Israel 3.0558 (6.460000 / 2.1140)
44. Trinidad and Tobago 3.0410 (2.578700 / 0.8480)
45. Romania 2.9008 (53.394100 / 18.4069)
46. Bulgaria 2.8308 (22.270700 / 7.8674)
47. Slovenia 2.8060 (4.446800 / 1.5847)
48. Japan 2.4942 (232.499600 / 93.2160)
49. Argentina 2.3809 (48.764500 / 20.4818)
50. Republic of Serbia 2.3728 (15.679700 / 6.6080)
51. Tajikistan 2.2586 (4.713800 / 2.0871)
52. Italy 2.1754 (109.203100 / 50.1997)
53. North Korea 2.0823 (23.788400 / 11.4242)
54. Macedonia 2.0030 (2.981800 / 1.4887)
55. Cuba 1.9166 (13.687100 / 7.1412)
56. Iran 1.7053 (37.358600 / 21.9069)
57. Uruguay 1.6995 (4.314500 / 2.5386)
58. Armenia 1.6829 (3.153900 / 1.8741)
59. Bosnia and Herzegovina 1.6712 (5.390600 / 3.2257)
60. Mexico 1.6693 (63.052300 / 37.7719)
61. Chile 1.6570 (13.476500 / 8.1330)
62. Georgia 1.6112 (5.873800 / 3.6456)
63. Spain 1.6045 (48.865600 / 30.4550)
64. Zimbabwe 1.5736 (5.943100 / 3.7767)
65. Cyprus 1.5470 (0.886330 / 0.5729)
66. Suriname 1.5019 (0.432350 / 0.2879)
67. Lebanon 1.4272 (2.576000 / 1.8049)
68. Zambia 1.4183 (4.355300 / 3.0708)
69. Croatia 1.4022 (5.805200 / 4.1402)
70. Mongolia 1.3536 (1.293400 / 0.9555)
71. Albania 1.2570 (2.022200 / 1.6088)
72. China 1.1975 (798.799900 / 667.0700)
73. Guyana 1.1534 (0.659520 / 0.5718)
74. Iraq 1.1326 (8.256200 / 7.2898)
75. Greece 1.1272 (9.391500 / 8.3317)
76. Montenegro 1.1068 (0.531900 / 0.4806)
77. Malta 1.0435 (0.340750 / 0.3266)
78. Colombia 1.0207 (16.390500 / 16.0577)
79. Liechtenstein 0.9362 (0.015448 / 0.0165)
80. Portugal 0.9273 (8.213500 / 8.8577)
81. Jamaica 0.9017 (1.468400 / 1.6285)
82. Panama 0.8792 (0.996160 / 1.1330)
83. Singapore 0.8457 (1.392300 / 1.6464)
84. Peru 0.8040 (8.164600 / 10.1550)
85. Jordan 0.7964 (0.743140 / 0.9331)
86. Barbados 0.7455 (0.172210 / 0.2310)
87. Syria 0.7038 (3.218700 / 4.5735)
88. Yemen 0.6831 (3.631000 / 5.3154)
89. Antigua and Barbuda 0.6769 (0.036640 / 0.0541)
90. Saudi Arabia 0.6544 (2.674400 / 4.0865)
91. Brazil 0.6491 (46.851800 / 72.1792)
92. Turkey 0.6115 (16.798500 / 27.4723)
93. Egypt 0.6020 (16.032700 / 26.6329)
94. Algeria 0.5563 (6.151200 / 11.0579)
95. Malaysia 0.5151 (4.201500 / 8.1563)
96. South Korea 0.5014 (12.540100 / 25.0124)
97. Fiji 0.4935 (0.194190 / 0.3935)
98. Djibouti 0.4819 (0.040304 / 0.0836)
99. Libya 0.4781 (0.692500 / 1.4484)
100. Belize 0.4776 (0.043968 / 0.0921)
101. Tunisia 0.4126 (1.724100 / 4.1782)
102. Ecuador 0.3877 (1.761600 / 4.5437)
103. Costa Rica 0.3689 (0.490980 / 1.3308)
104. Guatemala 0.3256 (1.344200 / 4.1289)
105. Philippines 0.3169 (8.325100 / 26.2697)
106. Dominican Republic 0.3157 (1.039900 / 3.2942)
107. Sierra Leone 0.3083 (0.714480 / 2.3176)
108. Honduras 0.3019 (0.615400 / 2.0386)
109. Nicaragua 0.2996 (0.531160 / 1.7731)
110. Kenya 0.2985 (2.424100 / 8.1201)
111. Morocco 0.2949 (3.636000 / 12.3285)
112. Bolivia 0.2745 (1.003800 / 3.6570)
113. Mauritius 0.2723 (0.179540 / 0.6594)
114. Pakistan 0.2651 (11.926400 / 44.9887)
115. Gabon 0.2633 (0.131900 / 0.5009)
116. Mozambique 0.2620 (1.882400 / 7.1849)
117. Senegal 0.2580 (0.827380 / 3.2068)
118. India 0.2471 (111.325100 / 450.5477)
119. Grenada 0.2445 (0.021984 / 0.0899)
120. Indonesia 0.2437 (21.385200 / 87.7511)
121. Vietnam 0.2291 (7.483900 / 32.6700)
122. Sri Lanka 0.2285 (2.256700 / 9.8745)
123. El Salvador 0.2237 (0.618860 / 2.7663)
124. Ghana 0.2203 (1.461900 / 6.6352)
125. Republic of Congo 0.2195 (0.223500 / 1.0183)
126. Dominica 0.1831 (0.010992 / 0.0600)
127. Tonga 0.1785 (0.010992 / 0.0616)
128. Sao Tome and Principe 0.1710 (0.010992 / 0.0643)
129. Sudan 0.1651 (1.245800 / 7.5445)
130. Saint Lucia 0.1634 (0.014656 / 0.0897)
131. Paraguay 0.1597 (0.304050 / 1.9040)
132. Democratic Republic of the Congo 0.1521 (2.318500 / 15.2483)
133. Liberia 0.1474 (0.164880 / 1.1187)
134. Saint Vincent and the Grenadines 0.1358 (0.010992 / 0.0810)
135. Thailand 0.1354 (3.709500 / 27.3972)
136. Samoa 0.1349 (0.014656 / 0.1086)
137. Ivory Coast 0.1318 (0.461660 / 3.5036)
138. Myanmar 0.1249 (2.714800 / 21.7369)
139. Malawi 0.1198 (0.438350 / 3.6600)
140. United Arab Emirates 0.1189 (0.010992 / 0.0924)
141. Guinea 0.1174 (0.410370 / 3.4942)
142. Cape Verde 0.1088 (0.021954 / 0.2018)
143. Angola 0.1006 (0.548950 / 5.4549)
144. Eswatini 0.0980 (0.032976 / 0.3366)
145. Solomon Islands 0.0933 (0.010992 / 0.1178)
146. Equatorial Guinea 0.0861 (0.021984 / 0.2553)
147. United Republic of Tanzania 0.0824 (0.828060 / 10.0522)
148. Papua New Guinea 0.0796 (0.179540 / 2.2559)
149. Madagascar 0.0783 (0.399380 / 5.0994)
150. Nigeria 0.0754 (3.403200 / 45.1385)
151. Haiti 0.0739 (0.285580 / 3.8662)
152. Benin 0.0663 (0.161220 / 2.4316)
153. Uganda 0.0622 (0.421060 / 6.7671)
154. Central African Republic 0.0586 (0.087936 / 1.5017)
155. Comoros 0.0575 (0.010992 / 0.1911)
156. Cameroon 0.0524 (0.271140 / 5.1769)
157. Gambia 0.0502 (0.018320 / 0.3650)
158. Bangladesh 0.0461 (2.211900 / 48.0135)
159. Afghanistan 0.0460 (0.413880 / 8.9970)
160. Mauritania 0.0431 (0.036640 / 0.8504)
161. Togo 0.0417 (0.065952 / 1.5805)
162. Cambodia 0.0410 (0.234500 / 5.7224)
163. South Sudan 0.0398 (0.113200 / 2.8427)
164. Laos 0.0380 (0.080608 / 2.1209)
165. Somalia 0.0306 (0.084272 / 2.7560)
166. Guinea Bissau 0.0297 (0.018320 / 0.6161)
167. Rwanda 0.0238 (0.069825 / 2.9356)
168. Mali 0.0230 (0.120910 / 5.2637)
169. Chad 0.0183 (0.054960 / 3.0016)
170. Ethiopia 0.0159 (0.351630 / 22.1513)
171. Burundi 0.0130 (0.036431 / 2.7979)
172. Burkina Faso 0.0091 (0.043968 / 4.8293)
173. Niger 0.0086 (0.029312 / 3.3888)
174. Nepal 0.0080 (0.080608 / 10.1051)
175. Kiribati 0.0000 (0.000000 / 0.0412)
176. Botswana 0.0000 (0.000000 / 0.5027)
177. Seychelles 0.0000 (0.000000 / 0.0417)
178. Vanuatu 0.0000 (0.000000 / 0.0637)
15 of 193 countries are missing data for 1960
---------- Menu Options -----------
1. n countries w/highest CO2 in a given year (listed high to low)
2. n countries w/highest Population in a given year (high to low)
3. n countries w/highest CO2/Capita in a given year (high to low)
4. print a country's info
5. quit
Select a menu option
Enter a value between 1 and 5: 4
Enter the name of a country: Canada
Canada
1960 pop: 17.909009 2020 pop: 38.037204
1960 GDP: 40.461722 2020 GDP: 1645.423408
1960 1980 2000 2020 2022
192.716200 442.846900 567.096100 522.845300 547.943900
---------- Menu Options -----------
1. n countries w/highest CO2 in a given year (listed high to low)
2. n countries w/highest Population in a given year (high to low)
3. n countries w/highest CO2/Capita in a given year (high to low)
4. print a country's info
5. quit
Select a menu option
Enter a value between 1 and 5: 5
bye bye
Run showing error handling
This is an example run showing error handling for most menu options.
% python co2_ordering.py
---------- Menu Options -----------
1. n countries w/highest CO2 in a given year (listed high to low)
2. n countries w/highest Population in a given year (high to low)
3. n countries w/highest CO2/Capita in a given year (high to low)
4. print a country's info
5. quit
Select a menu option
Enter a value between 1 and 5: 9
9 is not a valid choice, try again
Enter a value between 1 and 5: 1
Enter a value for n:
Enter a value between 1 and 193: 2000
2000 is not a valid choice, try again
Enter a value between 1 and 193: 0
0 is not a valid choice, try again
Enter a value between 1 and 193: 2
Enter a year (one of 1960, 1980, 2000, 2020, 2022): 1980
The 2 largest CO2 emitters of 1980
Country Mt of CO2
----------------------------------------------------------
1. United States of America 4808.5564
2. European Union (27) 4077.5007
---------- Menu Options -----------
1. n countries w/highest CO2 in a given year (listed high to low)
2. n countries w/highest Population in a given year (high to low)
3. n countries w/highest CO2/Capita in a given year (high to low)
4. print a country's info
5. quit
Select a menu option
Enter a value between 1 and 5: 2
Enter a value for n:
Enter a value between 1 and 193: 199
199 is not a valid choice, try again
Enter a value between 1 and 193: 5
Enter 1960 or 2020 for the year: 1980
1980 is not a valid value, try again
Enter 1960 or 2020 for the year: 1960
The 5 Most Populous Countries of 1960
Country popluation (in millions)
-----------------------------------------------------------------
1. China 667.0700
2. India 450.5477
3. European Union (27) 356.9061
4. United States of America 180.6710
5. Russia 119.8970
---------- Menu Options -----------
1. n countries w/highest CO2 in a given year (listed high to low)
2. n countries w/highest Population in a given year (high to low)
3. n countries w/highest CO2/Capita in a given year (high to low)
4. print a country's info
5. quit
Select a menu option
Enter a value between 1 and 5: 3
Enter a value for n:
Enter a value between 1 and 193: 200
200 is not a valid choice, try again
Enter a value between 1 and 193: -1
-1 is not a valid choice, try again
Enter a value between 1 and 193: 5
Enter 1960 or 2020 for the year: 2022
2022 is not a valid value, try again
Enter 1960 or 2020 for the year: 2020
The 5 countries with the largest CO2/capita in 2020
Country CO2/capita ( Mtons / millions )
---------------------------------------------------------------------------
1. Qatar 35.5776 (102.501200 / 2.8811)
2. Brunei 25.3768 (11.101900 / 0.4375)
3. Trinidad and Tobago 25.0303 (35.029700 / 1.3995)
4. Kuwait 22.8804 (97.712400 / 4.2706)
5. Bahrain 21.9771 (37.395900 / 1.7016)
---------- Menu Options -----------
1. n countries w/highest CO2 in a given year (listed high to low)
2. n countries w/highest Population in a given year (high to low)
3. n countries w/highest CO2/Capita in a given year (high to low)
4. print a country's info
5. quit
Select a menu option
Enter a value between 1 and 5: 4
Enter the name of a country: USA
Sorry, USA is not in the database
---------- Menu Options -----------
1. n countries w/highest CO2 in a given year (listed high to low)
2. n countries w/highest Population in a given year (high to low)
3. n countries w/highest CO2/Capita in a given year (high to low)
4. print a country's info
5. quit
Select a menu option
Enter a value between 1 and 5: 5
bye bye