Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

separate alphanumeric list

### START FUNCTION
def create_dictionary(character_list):
    dictionary={'numbers':[],'uppercase':[],'lowercase':[]}
    for character in character_list:
        try:
            int(character)
            dictionary['numbers'].append(character)
        except:
            if character.isupper():
                dictionary['uppercase'].append(character)
            elif character.islower():
                dictionary['lowercase'].append(character)
    for item in dictionary:
        dictionary[item].sort()
    return dictionary
### END FUNCTION
Source by athena.explore-datascience.net #
 
PREVIOUS NEXT
Tagged: #separate #alphanumeric #list
ADD COMMENT
Topic
Name
5+9 =