def qsort (list):
if (len(list) > 1):
list = qsort(filter (lambda x: x <= list[0], list[1:])) + [list[0]] + qsort(filter (lambda x: x > list[0], list[1:]))
return list
Simple demonstration of how to use Functional Programming in Python to do a quick sort in a list of numbers.
#python #quicksort #lambda
#python #quicksort #lambda
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.