Python 2.7.5 (Don't judge me)
What I have (e.g.):
numbers = [1,3,5,1,3,5,7,0,2,2,9,1]
frequencies = [0,0,0,0,0,0,0,0,0,0]
I need a for loop that counts by going through the elements of numbers and modifying frequencies accordingly by indexing. frequencies should look like:
[1,3,2,2,0,2,0,1,0,1]
I tried using the len() function...for some reason...I just haven't found a way to incorporate count properly.
for n in numbers:
frequencies[n] += 1
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments