Count the occurrences of all items of the list in the tuple.

Given a tuple and a list as input, write a program to count the occurrences of all items of the list in the tuple. (Input: tuple = ('a', 'a', 'c', 'b', 'd'), list = ['a', 'b'], Output: 3)

# Input tuple and list

input_tuple = ('a', 'a', 'c', 'b', 'd')

input_list = ['a', 'b']

# Count occurrences of items from the list in the tuple

total_count = sum(input_tuple.count(item) for item in input_list)

# Display the total count

print("Total count:", total_count)




OUTPUT

Total count: 3