I'm struggling with what seems to be a simple case. I got to the point where I can search for specific input and I let the program print how many times the given input is within each element of the list.
So take for instance the following list:
title = ['hello 2017', 'hello 2019', 'bye 2017']
My (very simple) code:
for s in title:
count = s.count('2017')
print(count)
Ouput:
1
0
1
I tried to replace print(count) with the following:
if count == 1:
total =+ 1
print(total)
This only gives ' 1 ' when being printed.
I feel kinda dumb asking this question, but it would be nice if someone could give a hint.