Python List Comprehensions Help

Before you overthink it: This last version is completely overkill for your use case.

But as I wasn't sure if you need to match characters in a string as your code suggest, or words in a string as one of your post mentioned... This one can do both.

1 Like