from collections import Counter
lst1 = ["a", "b", "c"]
lst2 = ["d", "a" "d", "e", "a", "f", "a", "d", "b", "b", "c", "a", "b", "k", "e", "a", "c", "c", "b"]
counter = Counter(lst2)
for key in lst1:
print(f'{key}: {counter[key]}')
Python позволяет быстрее вести разработку
Принцип сортировки следующий - одновременно cat должно быть начиная с самого меньшего и dog от самого большего
from collections import Counter
names = ["a", "b", "c", "d", "a", "d", "d"]
print(list([k for k, v in Counter(names).items() if v == 1]))
filter(lambda s: s != "Bill", namelist)
[x for x in namelist if x != "Bill"]
filter('Bill'.__ne__, nameslist)
while "Bill" in namelist: namelist.remove("Bill")