worldfinder.get_capital

Functions

get_capital(country)

Retrieve the capital city of a given country.

Module Contents

worldfinder.get_capital.get_capital(country)[source]

Retrieve the capital city of a given country.

Parameters:

countrystr

The country in which the user wishes to find the capital city

Returns:

str

The capital city corresponding to the country passed

Raises:

TypeError

If country input is not a string.

ValueError

If country input contains an empty string OR If country input is not a valid country OR If no capital was found for given country

Examples:

get_capital(“Italy”) ‘Rome’