I can't remember what Python version is packaged with 10.2.x, but I think it was/is at least 2.5. You can use defaultdict to craft a fairly compact solution.
>>> import random
>>> import collections
>>>
>>> faux_cur = [(random.randint(2,8),random.random() * 100) for _ in xrange(20)]
>>> for cd, length in faux_cur:
... print cd, length
...
7 92.2475389655
4 83.9462712302
6 81.6108729337
6 74.8669001032
3 12.5043749507
7 31.419143564
5 78.0403699406
6 13.6414803142
4 32.3717355049
8 10.7456093313
3 92.3411062073
8 20.0692694293
2 32.0990645882
3 80.236745944
4 84.6515841245
6 42.7892118033
5 12.0345925176
5 56.4556372617
3 68.8038120762
7 60.5648194955
>>>
>>> count_sum = collections.defaultdict(lambda: (0,0))
>>> for cd, length in faux_cur:
... c,s = count_sum[cd]
... count_sum[cd] = c + 1, s + length
...
>>> for k,v in sorted(count_sum.iteritems(), key=lambda x: x[0]):
... print k,v
...
2 (1, 32.09906458822493)
3 (4, 253.88603917814936)
4 (3, 200.96959085957693)
5 (3, 146.5305997199382)
6 (4, 212.90846515451312)
7 (3, 184.23150202499107)
8 (2, 30.81487876056358)
>>>