Write a function longestWord(WORDS) in Python, that takes the dictionary, WORDS as an argument and returns the longest word (in lowercase) in the dictionary. If there are more than one words with the same length, return the first one in alphabetical order.

For example, Consider the following dictionary


The output should be:



Answer by student

Python function that takes a dictionary as an argument and returns the longest word in the dictionary - Teachoo.png

Detailed answer by teachoo

The rest of the post is locked. Join Teachoo Black to see the full post.

Go Ad-free
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 14 years. He provides courses for Maths, Science, Social Science, Physics, Chemistry, Computer Science at Teachoo.