[Python] Print total number of languages in data (Python assignment)

Discussão em 'Python' iniciado por Stack, Abril 19, 2025.

  1. Stack

    Stack Membro Participativo

    For an assignment in my 30 days Python course i have the following:

    Go to the data folder and use the countries_data.py file.

    What are the total number of languages in the data?

    So i have tried everything, but i cant seem to write a code that returns the total number of languages. I have gotten as far as this:

    for language in countries:
    for key in language:
    if key == ('languages'): print (key.count('languages'))


    But the output only shows how many times the key languages is in the file.

    I Wrote:

    for language in countries:
    for key in language:
    if key == language: print (key.items())


    I hope that someone can give me the right script.

    Continue reading...

Compartilhe esta Página