So here is the question:
Write a function named combine_sort
that has two parameters named my_list1
and my_list2
.
The function should combine these two lists into one new list and sort the result. Return the new sorted list.
Here is what I wrote:
my_list1 = [4, 10, 2, 5]
my_list2 = [-10, 2, 5, 10]
combine_sort = sorted(my_list1 + my_list2)
print(combine_sort)
The output works.
This is the answer they wanted.
def combine_sort(my_list1, my_list2):
unsorted = my_list1 + my_list2
sortedList = sorted(unsorted)
return sortedList
#Uncomment the line below when your function is done
print(combine_sort([4, 10, 2, 5], [-10, 2, 5, 10]))
What is that? why do they want that? How am I wrong? help