Freq Count in Python
freq = {}
for item in my_list:
if (item in freq):
freq[item] += 1
else:
freq[item] = 1
Amused Albatross
freq = {}
for item in my_list:
if (item in freq):
freq[item] += 1
else:
freq[item] = 1
>>> sentence = 'Mary had a little lamb'
>>> sentence.count('a')
4
import time
cando = True
number = 10
while cando:
print(number)
number = number - 1
time.sleep(1)
if number == 0:
cando = False