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 01:43:30 EDT 2013
On Sat, May 25, 2013 at 3:39 PM, <lokeshkoppaka at gmail.com> wrote:
> On Saturday, May 25, 2013 10:54:01 AM UTC+5:30, Chris Angelico wrote:
>> On Sat, May 25, 2013 at 3:15 PM, <lokeshkoppaka at gmail.com> wrote:
>>
>> > On Friday, May 24, 2013 1:34:51 PM UTC+5:30, lokesh... at gmail.com wrote:
>>
>> >> i need to write a code which can sort the list in order of 'n' without use builtin functions
>>
>> >>
>>
>> >> can anyone help me how to do?
>>
>> >
>>
>> > Note:
>>
>> > the list only contains 0's,1's,2's
>>
>> > need to sort them in order of 'n'
>>
>>
>>
>> In that case, you're not really ordering them, you're counting them.
>>
>> Look at the collections module; you can very easily figure out how
>>
>> many of each there are, and then reconstruct the list afterward.
>>
>>
>>
>> ChrisA
>
> but i need to do it with out using builtin functions
Depending on your definitions, that's either trivially easy (the
'collections' module is not builtin functions) or completely
impossible. Have fun.
ChrisA
More information about the Python-list
mailing list