Using (len) with an If statement

I have written a basic program that outputs my friends’ favourite programming languages. I now need to tidy the grammar so that where a friend has only one favourite language, the output reads “favourite language is” instead of “favourite languages are”

I was advised to “check length of language list, if length 1 use singular form, if 2 or more use other form, set these to a single variable that can be dropped into the print statement” Unfortunately I have no idea how to do that.

Can anyone assist please?

Thankyou in advance,


favourite_languages = {
‘jen’ : [‘python’, ‘ruby’],
‘sarah’ : [‘c’],
‘edward’ : [‘ruby’, ‘go’],
‘phil’ : [‘python’, ‘haskell’],

for name, languages in favourite_languages.items():
print(f"\n{name.title()}'s favourite languages are:")
for language in languages:

Which variable holds the language list for each person? As you step over
the favourite_languages dict, using:

for name, languages in favourite_languages.items()

the person’s name is in the variable “name” and the list of their
favourite languages is in the variable “languages”.

So you need to check the length of the languages variable:

if len(languages) == 1:
    # Only one language, use singular form.
    # Two or more languages, use plural form.