Answers for "count words in list python"

0

How to take total count of words in the list python

#How to find total count of "BMW" cars from the list

car_list = ["BMW", "Audi", "BMW", "Mercedez", "BMW", "Ferrari"]

count = 0

for cars in car_list:
    if cars == "BMW":
        count = count + 1
print("Total BMW Cars in Garage are:-", count)
Posted by: Guest on March-30-2021
0

calculate term frequency python

from collections import Counter

# Counter token frequency from a sentence
sentence = "Texas A&M University is located in Texas"

term_frequencies = Counter(sentence.split())
Posted by: Guest on May-27-2020

Python Answers by Framework

Browse Popular Code Answers by Language