CO2 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.py
---------- Menu Options -----------
1. list all countries w/C02 level above a given value in given year
2. list country w/lowest and country w/highest GDP in given year
3. list all countries whose CO2 level decreased in 2022 from its
largest value over all previous years
4. print all of a country's information
5. quit
Select a menu option
Enter a value between 1 and 5: 1
Enter a year (one of 1960, 1980, 2000, 2020, 2022): 1980
Enter a CO2 limit value
Enter a value between 0 and 20000: 300
Country 1980 CO2 emissions
> 300.0000
-----------------------------------------------------------
Canada 442.8469
China 1494.4959
European Union (27) 4077.5007
France 511.0467
Germany 1100.0660
Italy 386.4330
Japan 944.8686
Poland 463.3291
Russia 2129.1103
Ukraine 674.8597
United Kingdom 579.0354
United States of America 4808.5564
Total of 12 countries > 300.0000 in 1980
---------- Menu Options -----------
1. list all countries w/C02 level above a given value in given year
2. list country w/lowest and country w/highest GDP in given year
3. list all countries whose CO2 level decreased in 2022 from its
largest value over all previous years
4. print all of a country's information
5. quit
Select a menu option
Enter a value between 1 and 5: 1
Enter a year (one of 1960, 1980, 2000, 2020, 2022): 2022
Enter a CO2 limit value
Enter a value between 0 and 20000: 300
Country 2022 CO2 emissions
> 300.0000
-----------------------------------------------------------
Australia 392.2793
Brazil 483.4773
Canada 547.9439
China 11396.7774
European Union (27) 2761.9071
Germany 665.6047
India 2829.6442
Indonesia 728.8833
Iran 690.6353
Italy 338.0973
Japan 1053.7979
Mexico 511.9720
Poland 323.1173
Russia 1652.1773
Saudi Arabia 662.5494
South Africa 404.0540
South Korea 600.9993
Turkey 435.6846
United Kingdom 318.6544
United States of America 5057.3038
Vietnam 343.6066
Total of 21 countries > 300.0000 in 2022
---------- Menu Options -----------
1. list all countries w/C02 level above a given value in given year
2. list country w/lowest and country w/highest GDP in given year
3. list all countries whose CO2 level decreased in 2022 from its
largest value over all previous years
4. print all of a country's information
5. quit
Select a menu option
Enter a value between 1 and 5: 2
Enter one of 1960 or 2020 for the year 1960
---- GDP in 1960
lowest: 0.01201 in Seychelles
highest: 543.30000 in United States of America
---------- Menu Options -----------
1. list all countries w/C02 level above a given value in given year
2. list country w/lowest and country w/highest GDP in given year
3. list all countries whose CO2 level decreased in 2022 from its
largest value over all previous years
4. print all of a country's information
5. quit
Select a menu option
Enter a value between 1 and 5: 2
Enter one of 1960 or 2020 for the year 2020
---- GDP in 2020
lowest: 0.05505 in Tuvalu
highest: 20893.74383 in United States of America
---------- Menu Options -----------
1. list all countries w/C02 level above a given value in given year
2. list country w/lowest and country w/highest GDP in given year
3. list all countries whose CO2 level decreased in 2022 from its
largest value over all previous years
4. print all of a country's information
5. quit
Select a menu option
Enter a value between 1 and 5: 3
Country 2022 level Previous High
---------------------------------------------------------------------
Albania 4.9547 5.1708
Andorra 0.3686 0.5240
Angola 16.0703 16.7648
Antigua and Barbuda 0.6022 0.6192
Armenia 6.4078 7.7198
Australia 392.2793 396.6852
Austria 61.4884 66.1717
Azerbaijan 38.0627 46.1098
Barbados 1.2328 1.7488
Belarus 58.8011 97.2026
Belgium 89.6054 134.8358
Bosnia and Herzegovina 19.7357 20.8318
Brunei 10.7537 11.1019
Bulgaria 46.1475 77.2506
Cameroon 9.5727 9.7016
Canada 547.9439 567.0961
Central African Republic 0.2262 0.2382
Croatia 17.5261 19.6600
Cuba 20.9210 31.3740
Cyprus 7.0294 7.1046
Czech Republic 97.9693 184.6774
Democratic Republic of the Congo 3.6016 3.7097
Denmark 29.0593 60.2862
Dominica 0.1532 0.1575
Equatorial Guinea 5.0762 5.5248
Estonia 10.3118 35.3139
European Union (27) 2761.9071 4077.5007
Federated States of Micronesia 0.1512 0.1795
Finland 36.1630 58.1393
France 297.5339 511.0467
Gabon 5.7056 6.6247
Georgia 11.0929 14.2958
Germany 665.6047 1100.0660
Greece 59.6628 102.9732
Haiti 2.4467 2.5126
Hungary 44.3536 86.6088
Ireland 38.7840 45.2491
Israel 56.1181 59.5194
Italy 338.0973 470.5241
Jamaica 6.4876 10.3140
Japan 1053.7979 1263.7548
Kyrgyzstan 9.4497 19.9884
Latvia 6.5915 23.1963
Liberia 0.8769 2.0376
Liechtenstein 0.1499 0.2169
Lithuania 12.6672 36.4222
Luxembourg 7.5241 11.5078
Macedonia 7.5884 9.1082
Malta 1.6551 2.4682
Moldova 5.4220 36.4127
Montenegro 2.2925 2.4072
Nauru 0.0529 0.1246
Netherlands 125.3582 176.6318
New Zealand 32.2118 34.2373
North Korea 50.8716 114.0822
Norway 40.8080 42.1100
Pakistan 200.1999 200.6028
Poland 323.1173 463.3291
Portugal 41.6050 65.6114
Qatar 101.3404 102.5012
Republic of Serbia 43.5066 47.9812
Romania 73.5213 195.8066
Russia 1652.1773 2129.1103
Saint Kitts and Nevis 0.2245 0.2308
Saint Lucia 0.4703 0.4837
Saint Vincent and the Grenadines 0.2387 0.2455
Sao Tome and Principe 0.1323 0.1392
Singapore 53.2524 54.8134
Slovakia 34.1517 59.1006
Slovenia 12.7148 15.0538
Somalia 0.6469 0.8134
South Africa 404.0540 434.8286
Spain 245.6138 310.0712
Sri Lanka 17.3271 20.6247
Sweden 38.0505 71.7137
Switzerland 35.3802 43.6142
Syria 27.6353 54.1711
Tajikistan 10.0174 11.4114
Thailand 270.7464 271.8520
The Bahamas 2.1200 7.9721
Trinidad and Tobago 34.3317 35.0297
Ukraine 141.2530 674.8597
United Kingdom 318.6544 584.0200
United States of America 5057.3038 6010.1359
Uzbekistan 120.6102 123.4773
Venezuela 76.8920 142.8349
Vietnam 343.6066 363.3427
Yemen 11.3563 15.7253
Zimbabwe 8.8560 13.8182
Total of 89 countries with decrease in CO2 in 2022
---------- Menu Options -----------
1. list all countries w/C02 level above a given value in given year
2. list country w/lowest and country w/highest GDP in given year
3. list all countries whose CO2 level decreased in 2022 from its
largest value over all previous years
4. print all of a country's information
5. quit
Select a menu option
Enter a value between 1 and 5: 4
Enter the name of a country: Sri Lanka
Sri Lanka
1960 pop: 9.874476 2020 pop: 21.919000
1960 GDP: 1.409874 2020 GDP: 80.969684
1960 1980 2000 2020 2022
2.256700 3.388600 10.134100 20.624700 17.327100
---------- Menu Options -----------
1. list all countries w/C02 level above a given value in given year
2. list country w/lowest and country w/highest GDP in given year
3. list all countries whose CO2 level decreased in 2022 from its
largest value over all previous years
4. print all of a country's information
5. quit
Select a menu option
Enter a value between 1 and 5: 4
Enter the name of a country: Brazil
Brazil
1960 pop: 72.179235 2020 pop: 212.559409
1960 GDP: 17.030466 2020 GDP: 1448.565937
1960 1980 2000 2020 2022
46.851800 186.190700 340.183000 444.504300 483.477300
---------- Menu Options -----------
1. list all countries w/C02 level above a given value in given year
2. list country w/lowest and country w/highest GDP in given year
3. list all countries whose CO2 level decreased in 2022 from its
largest value over all previous years
4. print all of a country's information
5. quit
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.py
---------- Menu Options -----------
1. list all countries w/C02 level above a given value in given year
2. list country w/lowest and country w/highest GDP in given year
3. list all countries whose CO2 level decreased in 2022 from its
largest value over all previous years
4. print all of a country's information
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 year (one of 1960, 1980, 2000, 2020, 2022): 1999
1999 is not a valid value, try again
Enter a year (one of 1960, 1980, 2000, 2020, 2022): 2000
Enter a CO2 limit value
Enter a value between 0 and 20000: -50
-50 is not a valid choice, try again
Enter a value between 0 and 20000: 33333333
33333333 is not a valid choice, try again
Enter a value between 0 and 20000: 10000
Country 2000 CO2 emissions
> 10000.0000
-----------------------------------------------------------
Total of 0 countries > 10000.0000 in 2000
---------- Menu Options -----------
1. list all countries w/C02 level above a given value in given year
2. list country w/lowest and country w/highest GDP in given year
3. list all countries whose CO2 level decreased in 2022 from its
largest value over all previous years
4. print all of a country's information
5. quit
Select a menu option
Enter a value between 1 and 5: 2
Enter one of 1960 or 2020 for the year 1999
1999 is not a valid value, try again
Enter one of 1960 or 2020 for the year 2020
---- GDP in 2020
lowest: 0.05505 in Tuvalu
highest: 20893.74383 in United States of America
---------- Menu Options -----------
1. list all countries w/C02 level above a given value in given year
2. list country w/lowest and country w/highest GDP in given year
3. list all countries whose CO2 level decreased in 2022 from its
largest value over all previous years
4. print all of a country's information
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. list all countries w/C02 level above a given value in given year
2. list country w/lowest and country w/highest GDP in given year
3. list all countries whose CO2 level decreased in 2022 from its
largest value over all previous years
4. print all of a country's information
5. quit
Select a menu option
Enter a value between 1 and 5: 5
bye bye