id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

amgreyson@gmail.com > genSort
prev  |  next  |  chance

Use recursion to write a sorting function genSort(aList) which takes in aList and should return a list with the same elements as aList, but in ascending order. Feel free to use the Python max or min functions. Example: for input [7, 9, 4, 3, 0, 5, 2, 6, 1, 8], return [0, 1, 2, 3, 4, 5, 6, 7, 8, 9].


genSort([7, 4, 3, 0, 5, 2, 6, 1]) → [0, 1, 2, 3, 4, 5, 6, 7]
genSort([]) → []
genSort([0, 1, 2, 3, 4, 5, 6]) → [0, 1, 2, 3, 4, 5, 6]

...Save, Compile, Run (ctrl-enter)

def genSort(aList):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Difficulty: 150 Post-solution available

Copyright Nick Parlante 2017 - privacy