https://www.codecademy.com/courses/python-intermediate-en-rCQKw/2/5?curriculum_id=4f89dab3d788890003000096#

When I execute my code, it gives me an error:

Oops, try again. median([4, 5, 5, 4]) resulted in an error: object of type 'NoneType' has no len()

I expected the code to work as intended. Is there a way to convert the input into a type list?

```
def median(numbers):
if len(list(numbers)) == 1:
return numbers[0]
nums_list = list(numbers).sort()
if len(nums_list) % 2 == 0:
index = len(nums_list) / 2
total = (nums_list[index] + nums_index[index + 1]) / 2.0
else:
index = int(nums_list / 2) + 1
total = nums_list[index]
return total
```