here's my code:
d = ['ant', 'bird', 'gecko', 'snake', 'wasp']
a = ['rabbit panda bird rabbit', 'bird gecko ant panda', 'wasp snake gecko ant']
b = []
for i in range (0, len(a)):
c = a[i].split()
for i in d:
b.append(c.count(i))
print(b)
here's the output:
[0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1]
but i want the desired output like this:
[[0, 1, 0, 0, 0], [1, 1, 1, 0, 0], [1, 0, 1, 1, 1]]