| t | import itertools | t | import itertools | 
            |  |  |  |  | 
            |  | def speed(path, stops, times): |  | def speed(path, stops, times): | 
            |  | stops_c = itertools.cycle(stops) |  | stops_c = itertools.cycle(stops) | 
            |  | path = iter(path) |  | path = iter(path) | 
            |  | times = iter(times) |  | times = iter(times) | 
            |  | temp = [] |  | temp = [] | 
            |  | st = next(stops_c) |  | st = next(stops_c) | 
            |  | for i in path: |  | for i in path: | 
            |  | if len(temp) == st: |  | if len(temp) == st: | 
            |  | yield (sum(temp) / next(times)) |  | yield (sum(temp) / next(times)) | 
            |  | temp = [i] |  | temp = [i] | 
            |  | st = next(stops_c) |  | st = next(stops_c) | 
            |  | else: |  | else: | 
            |  | temp.append(i) |  | temp.append(i) | 
            |  | yield (sum(temp) / next(times)) |  | yield (sum(temp) / next(times)) |