how to count the number of items in a list which is nested in a dictionary?

hey there I’m learning python and need to count the items in nested lists like below, so that I can give an answer based on if the person has one or more favourite languages:

favourite_languages = {
    'Joe': ['French'],
    'Jim': ['Spanish', 'Portugese'],
    'Alan':['German', 'Swedish']
}
for name, lang in favourite_languages.items():
    if len(name) == 1:
        print(f"{name}'s favourite language is {lang}")
    elif len(name > 1):
        print(f"{name}'s favourite languages are {lang}")

Thank you guys very much!

Answer

You were close, you were just checking the length of the wrong variable…

favourite_languages = {
    'Joe': ['French'],
    'Jim': ['Spanish', 'Portugese'],
    'Alan':['German', 'Swedish']
}

for name, langs in favourite_languages.items():
    if not len(langs):
        print(f"{name} has no favorite language.")
    elif len(langs) == 1:
        print(f"{name}'s favourite language is {langs}")
    else:
        print(f"{name}'s favourite languages are {langs}")