I have the following list:
fruits = [“apple”, “banana”, “grape”, “kiwi”, “banana”, “apple”, “apple”, “watermelon”, “kiwi”, “banana”, “apple”,]
Now I have to develop a function called count_the_fruits that would take as its arguments a list of fruits and a variable argument list called words. The function should use dictionary comprehension to create a dictionary of words (key) and their corresponding counts (value).
words = ["apple", "banana", "kiwi"]
Expect Output:
{apple: 4, 'banana': 3, 'kiwi': 2}
Any help would be appreciated. Thanks!