Functions and Lists Mixed-Up Code Questions¶

Create a function called second_half that takes in lst as a parameter and returns the second half of lst. For example, second_half() should return , second_half([1, 2, 3]) should return [2, 3], and second_half([1, 2, 3, 4]) should return [3, 4].

Write a function called second_half that takes in lst as a parameter and returns the second half of lst. For example, second_half() should return , second_half([1, 2, 3]) should return [2, 3], and second_half([1, 2, 3, 4]) should return [3, 4].

Create a function called sum_of_split_num that takes in str_num_with_hyphens as a parameter and returns the sum of the integers that are split up by hyphens. For example, sum_of_split_num('978-876-4908') should return 6762 because 978 + 876 + 4908 = 6762. (Note: Integers are 0 or greater.)

Write a function called sum_of_split_num that takes in str_num_with_hyphens as a parameter and returns the sum of the integers that are split up by hyphens. For example, sum_of_split_num('978-876-4908') should return 6762 because 978 + 876 + 4908 = 6762. (Note: Integers are 0 or greater.)

Create a function called sort_descending that takes in lst_of_nums as a parameter and returns lst_of_nums in descending order. For example, sort_descending([100, 2000, -50]) should return [2000, 100, -50].

Write a function called sort_descending that takes in lst_of_nums as a parameter and returns lst_of_nums in descending order. For example, sort_descending([100, 2000, -50]) should return [2000, 100, -50].

Create a function called extend_two_lists_sort that takes in lst1 and lst2 as parameters, sorts both lists, and extends lst1 with lst2. For example, extend_two_lists_sort(['string', 'hello'], ['my', 'goodness']) should return ['hello', 'string', 'goodness', 'my'].

Write a function called extend_two_lists_sort that takes in lst1 and lst2 as parameters, sorts both lists, and extends lst1 with lst2. For example, extend_two_lists_sort(['string', 'hello'], ['my', 'goodness']) should return ['hello', 'string', 'goodness', 'my'].

Create a function called sort_and_get_median_num that takes in lst_of_nums as a parameter, sorts lst_of_nums, and returns the median of lst_of_nums. For example, sort_and_get_median_num([200, -5, 0, 75, 80, 60]) should return 67.5, and sort_and_get_median_num([200, -5, 0, 75, 80]) should return 75.

Write a function called sort_and_get_median_num that takes in lst_of_nums as a parameter, sorts lst_of_nums, and returns the median of lst_of_nums. For example, sort_and_get_median_num([200, -5, 0, 75, 80, 60]) should return 67.5, and sort_and_get_median_num([200, -5, 0, 75, 80]) should return 75.