>>        temp_values1 =
>> (x.pop(9))+(x.pop(8))+(x.pop(7))+(x.pop(6))+(x.pop(5))+(x.pop(4))+(x.pop(3))+(x.pop(2))+(x.pop(1))+(x.pop(0))
>> temp_values2 =
>> (x.pop(19))+(x.pop(18))+(x.pop(17))+(x.pop(16))+(x.pop(15))+(x.pop(14))+(x.pop(13))+(x.pop(12))+(x.pop(11))+(x.pop(10))

When you pop a value, it is removed from the list. If you had a list with only 
two items and you tried to pop 0 and then you tried to pop item 1 you would get 
an error: after popping item 0 there would only by a single item left...which 
would also be item 0.

If you want to take the popping approach, every line should be the same as your 
first which pops, in reverse order, the first 10 items from x. AFter popping 
the first 10, the next ten are now where the first 10 used to be. But you could 
also not pop them and take them something like this:

    >>> l=range(10)
    >>> l1 = reversed(l[0:5]);l1
    [4, 3, 2, 1, 0]
    >>> l2 = reversed(l[5:10]);l2
    [9, 8, 7, 6, 5]

Here, you are not popping them, you are just taking a slice from the list l.

HTH,
/c
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to