Ad

Given a string s return an organized string in alphabetical order. Capital letters should be returned first. Number digits should be at the end of the returned string, and should be returned in numerical order. Ignore any special characters.

def sort(s):
    from string import ascii_lowercase, ascii_uppercase
    alphabet = list(ascii_uppercase) + list(ascii_lowercase) + list("0123456789")
    out = ""
    for letter in alphabet:
        for char in s:
            if char == letter:
                out += char
    return out