worldfinder.get_country_statistic

Functions

get_country_statistic(country, statistic)

Returns an integer or float representing a specific piece of

Module Contents

worldfinder.get_country_statistic.get_country_statistic(country, statistic)[source]

Returns an integer or float representing a specific piece of information about a country. Possible statistics include population, GDP, and surface area.

Parameters:
  • country (str) – The name of a country

  • statistic (str) – The name of the statistic of interest

Returns:

  • string – The value corresponding to the specified statistic for a specified country.

  • Raises

  • ——-

  • TypeError – If country or statistic are not a string.

  • ValueError – If country or statistic contain an empty string OR If statistic is not population, gdp, birth rate, cpi, or unemployment rate OR If country is not a valid country

Examples

>>> getCountryStatistic("Canada", "population")
'36,991,981'