help how to sort a list in order of 'n' in python without using inbuilt functions??

Chris Angelico rosuav at gmail.com
Sat May 25 05:01:09 EDT 2013


On Sat, May 25, 2013 at 6:54 PM, Carlos Nepomuceno
<carlosnepomuceno at outlook.com> wrote:
> lol
>
> def absolute(x):
>     return x if x>0 else -x
>
> def reach(x):
>     y=[]
>     z=0
>     while z<x:
>         y.append(z)
>         z+=1
>     return y

Very good. You are now in a position to get past the limitations of a
restricted-environment eval/exec. Avoiding builtins is actually a fun
skill to hone.

ChrisA



More information about the Python-list mailing list