Advertisement
maurobaraldi

Counting Intervals

Aug 14th, 2011
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.24 KB | None | 0 0
  1. mylist = [4,4,1,18,2,15,6,14,2,16,2,17,12,3,12,4,15,5,17,4,4,6]
  2. count, I = 0, 0
  3. for j in set(mylist):
  4.     for i in mylist:
  5.         if i == j:
  6.             if I == 0:
  7.                 I=1
  8.                 count+=1
  9.         else:
  10.             I=0
  11.     print "Index: %s. Count: %s" % (j, count)
  12.     count, I = 0, 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement