####################################################### # # Sort Algorithm by Jonas Konrath # 19.1.2017 # ######################################################## def sort(): L=[] x=int q=int while(x!=99): x = (input("Listenelement: ")) if(x == ""): print("O_o sicher dumm!") q = 1 else: x = int(x) if(x!=99 and q!=1): L.append(x) q = 0 print(L) t = 0 while(t<(int(len(L)**2))): for i in range(0,len(L)): x = i+1 if(x>=len(L)): x -= 1 y = i-1 if(y<0): y += 1 if(L[i]<=L[x] and L[i]>=L[y]): #print() m = 0 elif(L[i]>L[(i+1)]): L[i],L[(i+1)] = L[i+1],L[i] #print("changed") #print(y,i,x) elif(L[i]<L[(i-1)]): L[i],L[(i-1)] = L[i-1],L[i] #print("changed") #print(y,i,x) else: print("fuck you too") t += 1 print("") print("") print("") print("") print(L) sort()
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question