User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Python section within the Software Development category of DaniWeb, a massive community of 428,474 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,191 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Python advertiser: Programming Forums
Views: 340 | Replies: 4
Join Date: Apr 2008
Posts: 32
Reputation: Mackjan is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
Mackjan Mackjan is offline Offline
Light Poster

Special sort a list

  #1  
May 8th, 2008
How can i create a function which sort a list in this way for example if list 4,4,2
4,4,2
3,3,1,3
2,2,0,2,4
1,1,0,1,3,4
0,0,0,0,2,3,4
0,0,0,0,0,1,2,3,4
If the list is impossible to sort then the program have to try it 15 times not more.
The function which I wrote does it only one time not more??
x=[4,4,2]
def kopi(x):
    b=0
    y = []
    for j in x:
        b+=1
        y.append(j-1)
    y.append (b)
    print y,b 
    return y
can anyone help me?
Thanks a lot for all help and advice.
AddThis Social Bookmark Button
Reply With Quote  

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Python Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Python Forum

All times are GMT -4. The time now is 9:25 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC