Skip to content

Instantly share code, notes, and snippets.

@Dbhardwaj99
Last active January 11, 2022 20:04
Show Gist options
  • Save Dbhardwaj99/7a2b5de41fda5d6dea8dd76e45bbf7f9 to your computer and use it in GitHub Desktop.
Save Dbhardwaj99/7a2b5de41fda5d6dea8dd76e45bbf7f9 to your computer and use it in GitHub Desktop.
def flo_sorting(list):
length = len(list)
i = a = b = c = d = e = 0
list2 = []
newlist = []
while i != length:
if list[i][-1] == ':':
e = list[i]
list2 = list[i+1:]
list2 = flo_sorting(list2)
break
elif list[i][-1] == '#':
a = list[i]
elif list[i][-1] == '*':
b = list[i]
elif list[i][-1] == '$':
c = list[i]
elif list[i][-1] == '@':
d = list[i]
else:
break
i = i+1
if d != 0:
newlist.append(d)
if b != 0:
newlist.append(b)
if a != 0:
newlist.append(a)
if c != 0:
newlist.append(c)
if e != 0:
newlist.append(e)
if list2 == []:
return newlist
else:
newlist = newlist+list2
return newlist
@rubykar
Copy link

rubykar commented Jan 11, 2022

Looks amazing , honestly well thought out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment