Skip to content

Commit a0d9df3

Browse files
authored
Update Countries_Details.py
1 parent 59ae63f commit a0d9df3

File tree

1 file changed

+26
-21
lines changed

1 file changed

+26
-21
lines changed

Python_Begginer_Projects/Amazing/Countries_Details.py

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,30 @@
11
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)
27

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.')
429

5-
while count != '-1':
6-
country = CountryInfo(count)
730

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

Comments
 (0)