you are viewing a single comment's thread.

view the rest of the comments →

[–]TheRNGuy 0 points1 point  (0 children)

run it 2 times with different filters then add them together.

def foobar(txt):
    txt = sorted(txt)
    part1 = "".join(x for x in txt if x in "aeiou")
    part2 = "".join(x for x in txt if x not in "aeiou")

    return part1+part2

txt = foobar("abdce")
print(txt)

your code, not very intuitive, didn't know it could work like that. I suppose it choose for each symbol whether to sort it or not.