[Tutor] detecting a change in a iterable object (list, array, etc.)

Tim Michelsen timmichelsen at gmx-topmail.de
Tue Nov 27 01:24:08 CET 2007


Hello,
would like to ask for your help on the following issue:
What procedure can I use to detect if there's a change when iterating 
over a list?

For instance if I want to extract the years 1997 and 1998 from the table 
below and save them into separate files?
How do I build the average only on the 1997-year values?
Or how do find out that there is three successive values 3*2 and 3*2 in 
the volume column?

I already tried a for-loop in connection with a last_value == current 
value comparison but wasn't successful at all.

Therefore, I highly appreaciate any hint or pointer!


Example data:

Year	month	volume
1997	1	2
1997	2	2
1997	3	2
1997	4	5
1997	5	2
1997	7	1
1998	1	2
1998	2	6
1998	3	3
1998	4	3
1998	5	3
1998	6	1

Thanks and kind regards,
Tim Michelsen



More information about the Tutor mailing list