comparison trafficintelligence/tests/utils.txt @ 1034:4069d8545922

updated mostCommong function
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Wed, 20 Jun 2018 12:04:22 -0400
parents aafbc0bab925
children 77fbd0e2ba7d
comparison
equal deleted inserted replaced
1033:8ffb3ae9f3d2 1034:4069d8545922
53 'b' 53 'b'
54 >>> mostCommon(['a','b','c','b', 'c']) 54 >>> mostCommon(['a','b','c','b', 'c'])
55 'b' 55 'b'
56 >>> mostCommon(list(range(10))+[1]) 56 >>> mostCommon(list(range(10))+[1])
57 1 57 1
58 >>> mostCommon([list(range(2)), list(range(4)), list(range(2))]) 58 >>> mostCommon([(1,2), (2,3), (1,2)])
59 [0, 1] 59 (1, 2)
60 60
61 >>> res = sortByLength([list(range(3)), list(range(4)), list(range(1))]) 61 >>> res = sortByLength([list(range(3)), list(range(4)), list(range(1))])
62 >>> [len(r) for r in res] 62 >>> [len(r) for r in res]
63 [1, 3, 4] 63 [1, 3, 4]
64 >>> res = sortByLength([list(range(3)), list(range(4)), list(range(1)), list(range(5))], reverse = True) 64 >>> res = sortByLength([list(range(3)), list(range(4)), list(range(1)), list(range(5))], reverse = True)