Skip to content
Advertisement

Tag: word

How to find the longest word with python?

How can I use python to find the longest word from a set of words? I can find the first word like this: Answer If I understand your question correctly: split() splits the string into words (seperated by whitespace); max() finds the largest element using the builtin len() function, i.e. the string length, as the key to find out what

Advertisement