sith . wrote:
> a = [[1,1],[3,1.5],[5,0]]
> for i in range(len(a)) :

This should use range(1, len(a)). You don't want i to take on the value 0.

>     if a[i][1] > a[i-1][1] :

When i==0 this compares a[0] to a[-1] which is the *last* element of the 
list; a[0][1] > a[-1][1] so it prints 'greater !!'.

Kent

PS Please reply to the original post rather than starting a new thread.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to