Hello!
It’s the first time I’m using Python and can’t find the right function for the question below. I’ve tried unsuccessfully in many ways.
QUESTION
From the dictionary (country with number of population) below I have to find a function that allows me to visualize the countries with a population < 50 millions of inhabitants.
Thank you for your help!
I've got the following error:
Populations = {
"Allemagne" : 81,
"Italie" : 60,
"Suisse" : 8.7,
"Luxembourg": 0.5,
"Belgique": 11,
"France" : 67.5,
"Espagne" : 46
}
def show_small_countries(population_data: dict[str, int | float]):
for country, population in population_data.items():
if populations < 50:
print(f"{country}: {population}")
show_small_countries(population)
ameError Traceback (most recent call last)
Input In [39], in <cell line: 6>()
3 if populations < 50:
4 print(f"{country}: {population}")
----> 6 show_small_countries(population)
NameError: name 'population' is not defined