The easiest way is to use Python's count() function (and then test for a result > 0) for smaller groups of numbers. Some info on using lists. A list can also be used by element or index number. Element[0] = the number of zeros found, element[1] = number of ones, etc. which can then be multiplied by the element/index number to get the result. You can also use a dictionary, with the key equal to the number, pointing to an integer that counts the number of times the number appears.

number_list = [5, 3, 11, 3, 7, 3, 5, 5, 11, 7, 7 ]
for num in range(12):
print "%d:%d:%d" % (num, number_list.count(num), num*number_list.count(num))

I think I figured out how to avoid the problem I mentioned above. For those who would be interested, I've used a dictionary to store the frequency. Here's the final code-

lis=['a','a','a','b','b','d','d','f']
diction={}
for char in lis:
diction[char]=lis.count(char)
print (diction)

How can I make this to continue until the user presses N? I've tried using while(1), while( option == 'y' || option == 'Y') but it kept giving an error ...