On Nov 15, 2007 12:37 PM, sith . <[EMAIL PROTECTED]> wrote:

> a = [[1,2],[3,1.5],[5,6]]
> for i in a:
>     print i
>     if i[1]>i[0]:
>         print "second index is larger"
>     else:
>         print "second index is smaller"
> [1, 2]
> second index is larger
> [3, 1.5]
> second index is small
> er
> [5, 6]
> second index is larger
>
> What I'd like do is compare if 1.5 in i[1] is greater than 2 in i[0];
> for time series, t(1)>t(0) and interate through the entire list - is 6 in
> i[2]>than 1.5 in i[1] etc?
> Since the data is in columns in a text file or csv, I can't put 1.5 in the
> same sublist as 2, and 6 in the same sublist as 1.5 to make things
> easier.  What can I do?
> Thank you for your help.
>
> ------------------------------
>
>
for i in range(1,len(a)) :
  if a[i][1] > a[i-1][1] :
     print 'greater !!' # or whatever you want

-- 
Aditya
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to