In [1]:
from pprint import pprint
words = ["uno", "dos", "tres", "foo", "bar", "baz", "biz"]
result = [word.upper() for word in words if word.startswith('b') or word.endswith('s')]
pprint(result)
In [3]:
from pprint import pprint
tags = ['man', 'you', 'are', 'awesome']
entries = [['man', 'thats'], ['right', 'awesome']]
result = [entry for tag in tags for entry in entries if tag in entry]
pprint(result)
In [4]:
from pprint import pprint
some_list = ['a', 'b', 'c']
some_list.extend(['d', 'e'])
pprint(some_list)