Hi Lyu, 2007/10/18, Lyu Abe <[EMAIL PROTECTED]>: > Is there a very simple way of addressing elements in a > reversed way in a list?
Yep, use [::-1] operator ([:] operator with a negative step): >>> l=[1,2,3,4] >>> for i in l[::-1]: print i 4 3 2 1 Explanation in the Python library doc: http://docs.python.org/lib/typesseq.html The Python doc (http://docs.python.org/) is very useful. Most of the time, the thing you are looking for are either in the Language Reference (http://docs.python.org/ref/ref.html) or in the Library Reference (http://docs.python.org/lib/lib.html). BTW, please note that there is no guarantee of the demexp server to sort the list in a specific order (the current reverse order comes from the current sequence of processing in the server, that might change in the future). Each question contains its question number (parameter q_id, qu['q_id'] in your code) and you should sort the list according to that. Yours, d. _______________________________________________ Demexp-dev mailing list Demexp-dev@nongnu.org http://lists.nongnu.org/mailman/listinfo/demexp-dev