Select the long ones

Report a typo

Suppose we need to analyze a poem we have written. We want to examine words that are longer than five letters. How can we do this using list comprehension? Take a sentence from the input and print the list.

You can use the split(" ") method to separate the words.

Sample Input 1:

With thoughts of sadness in his head

Sample Output 1:

['thoughts', 'sadness']
Write a program in Python 3
words = [...]
___

Create a free account to access the full topic