Checkpoint 5.30.1.
- [-2, 0, 1, 4.2, 5.2]
- Incorrect. This function will sort the list in order from lowest to highest, and then add the sum to the end of the list.
- [-2, 0, 1, 5.2, 4.2]
- Correct! It sorts the list in ascending order and then adds the sum at the end.
- [4.2, -2, 0, 1, 5.2]
- Incorrect. This function will sort the list in order from lowest to highest, and then add the sum to the end of the list.
- [0, -2, 5.2, 1, 4.2]
- Incorrect. This function will sort the list in order from lowest to highest, and then add the sum to the end of the list.
- [5.2, 1, 0, -2, 4.2]
- Incorrect. This function will sort the list in order from lowest to highest, and then add the sum to the end of the list.
Q-1: What would
list_transformation([0, -2, 5.2, 1])
return?def list_transformation(lst):
lst.sort()
sum_of_lst = sum(lst)
lst.append(sum_of_lst)
return lst