Sort your socks with the power of code!
# SockSortingAlgorithm
def sort_socks(socks):
if len(socks) == 0:
return []
# Sort by color
socks.sort(key=lambda x: x.color)
# Sort by texture
socks.sort(key=lambda x: x.texture)
# Sort by size
socks.sort(key=lambda x: x.size)
return socks
Want more? Visit our Sock Sorting Videos for more algorithmic awesomeness!