[ad_1]
Using list comprehension, str.startswith and sum
[sum(w.startswith(p) for w in word) for p in prefix] # [4, 2, 1]
3
[ad_2]
solved Count number of occurrences in a list
[ad_1]
Using list comprehension, str.startswith and sum
[sum(w.startswith(p) for w in word) for p in prefix] # [4, 2, 1]
3
[ad_2]
solved Count number of occurrences in a list