def life_forms(*args, **kwargs):
result = {}
for item, value in kwargs.items():
result[item] = []
for word in reversed(sorted(args)):
if len(word) in result[item]: continue
if any([*map(lambda x: x in word, list(item))]) and len(word) % value == 0:
result[item].append(len(word))
return result
data = ["demanding", "social",
"security", "voting", "rights"]
cond = {
"an": 3,
"sc": 2,
"oi": 6
}
print(life_forms(*data, **cond))
#>>> {'an': [6, 9], 'sc': [6, 8], 'oi': [6]}