How to create a while loop to cycle through a list and count instances of a certain word? Python -


this question has answer here:

i thinking, how make while loop cycle through list , count instances of word 'hello' example.

list = ['bob','hello','jacob','hello','count'] 

so expected output 2.

just use count (bonus: have "count" item in list ^^):

>>> ['bob','hello','jacob','hello','count'].count('hello') 2 

Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -