Find the median of an unsorted list.
Implement median_unsorted(nums) and return a numeric median. For an odd-length list, return the middle value after ordering. For an even-length list, return the arithmetic mean of the two middle values. The input contains at least one integer, and the function may modify nums in place.
Function signature: def median_unsorted(nums):
def median_unsorted(nums):