Given a list of numbers, count and return how many pairs there are. A pair exists when the same number appears in adjacent locations in the list. Do not alter the list in any way. Do not use any Python library functions with the list except len(). count_pairs([1, 30, 30, 0, 31, 31]) rightarrow 2 count_pairs([1, 2, 3, 1]) rightarrow 0 count_pairs([1, 1, 1, 7, 5]) rightarrow 2 Solution def count_pairs(list): # count holds the count of pairs count = 0 # iterate over the list till second last element # idx is index and element is the number onthat index for idx,element in enumerate(list[:-1]): # if we get a pair , increment the count if element == list[idx+1]: count = count + 1 # print the number of pairs print count count_pairs([1,30,30,0,31,31]) count_pairs([1,2,3,1]) count_pairs([1,1,1,7,5]) .