|
1 | 1 | from countryinfo import CountryInfo |
| 2 | +try: |
| 3 | + count = input('Enter the name of the country or -1 to quit: ') |
| 4 | + while count != '-1': |
| 5 | + |
| 6 | + country = CountryInfo(count) |
2 | 7 |
|
3 | | -count = input('Enter the name of the country or -1 to quit: ') |
| 8 | + print("Capital is: ", country.capital()) |
| 9 | + print('----------------------------------------------------------------') |
| 10 | + print('Currency is: ', country.currencies()) |
| 11 | + print('----------------------------------------------------------------') |
| 12 | + print('Language is: ', country.languages()) |
| 13 | + print('----------------------------------------------------------------') |
| 14 | + print('Borders are: ', country.borders()) |
| 15 | + print('----------------------------------------------------------------') |
| 16 | + print('Other names are: ', country.alt_spellings()) |
| 17 | + print('----------------------------------------------------------------') |
| 18 | + print('Population is: ', country.population()) |
| 19 | + print('----------------------------------------------------------------') |
| 20 | + print('Time zone is: ',country.timezones()) |
| 21 | + print('----------------------------------------------------------------') |
| 22 | + count = input('Enter the name of the country or -1 to quit: ') |
| 23 | + print('----------------------------------------------------------------') |
| 24 | + else: |
| 25 | + print('Thanks for using the program...') |
| 26 | +except KeyError: |
| 27 | + print('Country was not found!') |
| 28 | + print('Try Again with a valid country name.') |
4 | 29 |
|
5 | | -while count != '-1': |
6 | | - country = CountryInfo(count) |
7 | 30 |
|
8 | | - print("Capital is: ", country.capital()) |
9 | | - print('----------------------------------------------------------------') |
10 | | - print('Currency is: ', country.currencies()) |
11 | | - print('----------------------------------------------------------------') |
12 | | - print('Language is: ', country.languages()) |
13 | | - print('----------------------------------------------------------------') |
14 | | - print('Borders are: ', country.borders()) |
15 | | - print('----------------------------------------------------------------') |
16 | | - print('Other names are: ', country.alt_spellings()) |
17 | | - print('----------------------------------------------------------------') |
18 | | - print('Population is: ', country.population()) |
19 | | - print('----------------------------------------------------------------') |
20 | | - print('Time zone is: ',country.timezones()) |
21 | | - print('----------------------------------------------------------------') |
22 | | - count = input('Enter the name of the country or -1 to quit: ') |
23 | | - print('----------------------------------------------------------------') |
24 | | -else: |
25 | | - print('Thanks for using the program...') |
|
0 commit comments