how to get the ordinal number in list

Terry Reedy tjreedy at udel.edu
Tue Aug 12 18:01:12 EDT 2014


On 8/12/2014 1:40 PM, Neil D. Cerutti wrote:
> I disagree.  For a beginner, you want to be able to break things down
> into individual steps and examine the result at each point.  If you do:
>
>>>>> l= [6,2,9,12,1,4]
>>>>> l2 = sorted(l,reverse=True)
>
> you have the advantage that you can stop after creating l2 and print it
> out.  The student can see that it has indeed been sorted.

Or one can put the multiple steps in a file and step through with a 
debugger that shows local name values, like the Idle debugger.

-- 
Terry Jan Reedy




More information about the Python-list mailing list