comparison trafficintelligence/utils.py @ 1135:342701cdac30

bug fix for concatenate
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Thu, 05 Mar 2020 16:53:48 -0500
parents 91faf679e898
children f7fbe624fff7
comparison
equal deleted inserted replaced
1134:4b2a55d570c1 1135:342701cdac30
85 'Returns the dictionary that provides for each element in the input list its index in the input list' 85 'Returns the dictionary that provides for each element in the input list its index in the input list'
86 result = {} 86 result = {}
87 for i,x in enumerate(l): 87 for i,x in enumerate(l):
88 result[x] = i 88 result[x] = i
89 return result 89 return result
90
91 def findElement(l, num):
92 i = 0
93 while l[i].getNum() != num:
94 i += 1
95 if i < len(l):
96 return l[i]
97 else:
98 return None
90 99
91 ######################### 100 #########################
92 # Simple statistics 101 # Simple statistics
93 ######################### 102 #########################
94 103