I was just thinking, how could i make a while loop to cycle through a list and count instances of the word 'hello' for example.
list = ['bob','hello','jacob','hello','count']
so expected output would be 2.
I was just thinking, how could i make a while loop to cycle through a list and count instances of the word 'hello' for example.
list = ['bob','hello','jacob','hello','count']
so expected output would be 2.
However if you want to search without case, you can try
word = 'hello'
list = ['bob','hello','jacob','hello','count']
count = len([i for i in list if i.lower() == word.lower()])