CS21 Lab 9: Example Output
This is output from a large run of a working program.
-
It includes examples of each menu option, some menu options selected more than one time. Note that
-
It includes examples of handling bad input values from the user (not necessarily handling every possible case).
-
It shows examples of output printed in tabular format that your solution should mimic.
User input is shown in bold.
$ python3 climate2.py
There are data for 193 countries in this file
================== Menu ======================
1. The n largest C02 producing countries in given year
2. The CO2 values for n coutries with largest GDP in given year
3. The n largest CO2/population producing countries in a given year
4. Print a country's info
5. Quit
Select a menu option
Enter a value between 1 and 5: 1
Pick a value for n
Enter a value between 1 and 193: 10
Enter a year (one of 1960, 1980, 2000, 2020, 2022): 2000
2000 Emissions in Mt Country
-------------------------------------------------------
1. 6010.135900 United States of America
2. 3649.200900 China
3. 3601.508800 European Union (27)
4. 1479.142500 Russia
5. 1263.754800 Japan
6. 977.526400 India
7. 898.938000 Germany
8. 569.033700 United Kingdom
9. 567.096100 Canada
10. 470.524100 Italy
================== Menu ======================
1. The n largest C02 producing countries in given year
2. The CO2 values for n coutries with largest GDP in given year
3. The n largest CO2/population producing countries in a given year
4. Print a country's info
5. Quit
Select a menu option
Enter a value between 1 and 5: 1
Pick a value for n
Enter a value between 1 and 193: 5
Enter a year (one of 1960, 1980, 2000, 2020, 2022): 2022
2022 Emissions in Mt Country
-------------------------------------------------------
1. 11396.777400 China
2. 5057.303800 United States of America
3. 2829.644200 India
4. 2761.907100 European Union (27)
5. 1652.177300 Russia
================== Menu ======================
1. The n largest C02 producing countries in given year
2. The CO2 values for n coutries with largest GDP in given year
3. The n largest CO2/population producing countries in a given year
4. Print a country's info
5. Quit
Select a menu option
Enter a value between 1 and 5: 2
Pick a value for n
Enter a value between 1 and 193: 20
Enter a year (one of 1960 or 2020): 1960
1960 CO2(Mt) GDP(B) Country
------------------------------------------------------------
1. 2897.315300 543.300000 United States of America
2. 584.020000 73.233968 United Kingdom
3. 296.114100 62.225478 France
4. 798.799900 59.716468 China
5. 232.499600 44.307343 Japan
6. 192.716200 40.461722 Canada
7. 109.203100 40.385288 Italy
8. 111.325100 37.029884 India
9. 87.444300 18.606787 Australia
10. 46.851800 17.030466 Brazil
11. 49.170500 15.822585 Sweden
12. 16.798500 13.983573 Turkey
13. 63.052300 13.040000 Mexico
14. 73.437600 12.276734 Netherlands
15. 48.865600 12.072126 Spain
16. 90.908100 11.658723 Belgium
17. 19.498500 9.522747 Switzerland
18. 97.843500 8.748597 South Africa
19. 57.016800 7.779091 Venezuela
20. 8.325100 7.515887 Philippines
================== Menu ======================
1. The n largest C02 producing countries in given year
2. The CO2 values for n coutries with largest GDP in given year
3. The n largest CO2/population producing countries in a given year
4. Print a country's info
5. Quit
Select a menu option
Enter a value between 1 and 5: 2
Pick a value for n
Enter a value between 1 and 193: 193
Enter a year (one of 1960 or 2020): 188
188 is not a valid value, try again
Enter a year (one of 1960 or 2020): 2020
2020 CO2(Mt) GDP(B) Country
------------------------------------------------------------
1. 4714.628000 20893.743830 United States of America
2. 2629.970600 15300.141970 European Union (27)
3. 10914.012200 14687.673890 China
4. 1039.795900 5040.107754 Japan
5. 647.252300 3846.413929 Germany
6. 326.263200 2756.900214 United Kingdom
7. 2421.552300 2667.687952 India
8. 281.539000 2630.317731 France
9. 303.281300 1892.574064 Italy
10. 522.845300 1645.423408 Canada
...
185. 0.051296 0.114627 Nauru
186. 0.010992 0.055055 Tuvalu
7 of top 193 have missing CO2 or GDP data for 2020
================== Menu ======================
1. The n largest C02 producing countries in given year
2. The CO2 values for n coutries with largest GDP in given year
3. The n largest CO2/population producing countries in a given year
4. Print a country's info
5. Quit
Select a menu option
Enter a value between 1 and 5: 8
8 is not a valid choice, try again
Enter a value betweeen 1 and 5: 3
Pick a value for n
Enter a value between 1 and 193: 3000
3000 is not a valid choice, try again
Enter a value betweeen 1 and 193: -4
-4 is not a valid choice, try again
Enter a value betweeen 1 and 193: 5
Enter a year (one of 1960 or 2020): 1960
1960 C02(Mt)/M people CO2(Mt) Population(M) Country
----------------------------------------------------------------------
1. 36.652546 11.507800 0.313970 Luxembourg
2. 28.982329 7.797000 0.269026 Kuwait
3. 16.036416 2897.315300 180.671000 United States of America
4. 12.105945 14.666800 1.211537 Estonia
5. 11.178347 813.950200 72.814900 Germany
================== Menu ======================
1. The n largest C02 producing countries in given year
2. The CO2 values for n coutries with largest GDP in given year
3. The n largest CO2/population producing countries in a given year
4. Print a country's info
5. Quit
Select a menu option
Enter a value between 1 and 5: 3
Pick a value for n
Enter a value between 1 and 193: 10
Enter a year (one of 1960 or 2020): 2020
2020 C02(Mt)/M people CO2(Mt) Population(M) Country
----------------------------------------------------------------------
1. 35.577600 102.501200 2.881060 Qatar
2. 25.376757 11.101900 0.437483 Brunei
3. 25.030315 35.029700 1.399491 Trinidad and Tobago
4. 22.880449 97.712400 4.270563 Kuwait
5. 21.977124 37.395900 1.701583 Bahrain
6. 21.917041 216.768300 9.890400 United Arab Emirates
7. 17.543957 610.773000 34.813867 Saudi Arabia
8. 15.439267 396.685200 25.693267 Australia
9. 14.222059 4714.628000 331.501080 United States of America
10. 13.745629 522.845300 38.037204 Canada
================== Menu ======================
1. The n largest C02 producing countries in given year
2. The CO2 values for n coutries with largest GDP in given year
3. The n largest CO2/population producing countries in a given year
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: Qatar
Qatar
1960 pop: 0.047383 2020 pop: 2.881060
1960 GDP: missing 2020 GDP: 144.411363
1960 1980 2000 2020 2022
0.175870 13.081700 40.314500 102.501200 101.340400
================== Menu ======================
1. The n largest C02 producing countries in given year
2. The CO2 values for n coutries with largest GDP in given year
3. The n largest CO2/population producing countries in a given year
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: Norway
Norway
1960 pop: 3.581239 2020 pop: 5.379475
1960 GDP: 5.163272 2020 GDP: 362.198318
1960 1980 2000 2020 2022
13.086800 31.777000 42.110000 41.231000 40.808000
================== Menu ======================
1. The n largest C02 producing countries in given year
2. The CO2 values for n coutries with largest GDP in given year
3. The n largest CO2/population producing countries in a given year
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: hello
Sorry, hello is not in the database
================== Menu ======================
1. The n largest C02 producing countries in given year
2. The CO2 values for n coutries with largest GDP in given year
3. The n largest CO2/population producing countries in a given year
4. Print a country's info
5. Quit
Select a menu option
Enter a value between 1 and 5: 5
bye bye