On 07/23/2014 11:28 AM, Wolfgang Maier wrote:
breakpoints = [your_list_of breakpoints] large_value_buffer = [] int_list_iter = iter(int_list) # see comment below for breakpoint in breakpoints: sublist = large_value_buffer for value in int_list_iter: if value < breakpoint: sublist.append(value) if large_value_buffer: large_value_buffer = [] else: if sublist: print(sum(sublist)/len(sublist)) large_value_buffer.append(value)
oops, the last line above needs outdenting by one level.
break
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor