Path: csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; "subject:' ": 0.07; 'subject:help': 0.08; 'builtin': 0.09; 'counting': 0.09; 'friday,': 0.09; 'subject:using': 0.09; "'n'": 0.16; '24,': 0.16; 'collections': 0.16; 'definitions,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject: \n ': 0.16; 'trivially': 0.16; 'subject:python': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'module': 0.19; '(the': 0.22; 'sort': 0.25; 'header:In- Reply-To:1': 0.27; 'chris': 0.29; 'subject:list': 0.30; 'message- id:@mail.gmail.com': 0.30; 'code': 0.31; "skip:' 10": 0.31; '25,': 0.31; 'anyone': 0.31; 'figure': 0.32; 'received:209.85': 0.35; 'received:209.85.220': 0.35; 'case,': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; 'are,': 0.36; 'list': 0.37; 'received:209': 0.37; 'easily': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'either': 0.39; 'how': 0.40; 'easy': 0.60; "you're": 0.61; 'email addr:gmail.com': 0.63; 'note:': 0.66; 'functions)': 0.84; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=idwLnwfDoP3ZytqbQh/4HDCPjADjvvI+fbIfbDYu6rc=; b=RwB5ZIuyUQZR0gmES4OEK3XZUTEANzJsTq6pLcX0zZRGbEZKmJT6OPt4ubgHl57nnz LSXv7jedjo1g0EalQI+BuBuT98UBPqADwr1L4QzawuxzkaScGXKuT4GwavlX/kRSMlw2 ldeQVvs9Cen0l1iDUBq2MPugDogeP7lYIW2Re/Bk4ntTVcWtoRRHbeAOTytUGrXp++Fw TZjhwTJZYznQ3+D8rqMHTKpKNnvsxIlfg39EgFXuaUp6MLuzty79gvrxS7hJhUIaITxC RbG3wXLmYo8c8mhaIjKA4wKGEPDlFbZTL3IPrmqKnSwv60E0ci0L8FZJYZs29AjBxMg9 J+Aw== MIME-Version: 1.0 X-Received: by 10.58.172.67 with SMTP id ba3mr10311250vec.58.1369460610910; Fri, 24 May 2013 22:43:30 -0700 (PDT) In-Reply-To: <39ac7437-857e-483f-998c-8162c1039933@googlegroups.com> References: <78192328-b31b-49d9-9cd6-ec742c092a29@googlegroups.com> <39ac7437-857e-483f-998c-8162c1039933@googlegroups.com> Date: Sat, 25 May 2013 15:43:30 +1000 Subject: Re: help how to sort a list in order of 'n' in python without using inbuilt functions?? From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 39 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1369460620 news.xs4all.nl 15898 [2001:888:2000:d::a6]:59090 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:45966 On Sat, May 25, 2013 at 3:39 PM, 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, wrote: >> >> > On Friday, May 24, 2013 1:34:51 PM UTC+5:30, lokesh...@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