Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Sort Mixed List

Problem

Given a list of multiple data types, sort each group of datatypes independently of the others. The "sorted" list still has a given datatype in the same position where the original list had an instance of that datatype, but all the instances of a particular datatype now appear, among themselves, in sorted order.

For instance, given

[2, 'a', 1, 'g', 3, 'c']

return

[1, 'a', 2, 'c', 3, 'g']

The integers 1, 2, 3 are now in sorted order, as are the strings 'a', 'c', 'g'. But the pattern of integers and strings in the returned list is the same as the pattern in the input list.

Do this for any number of datatypes found in the input string.

Other information

This is coded for Python3. There is a rudimentary test suite. The whole project was built in 25 minutes as a speed practice problem.

[end]