Median Function "TypeNone" Error


Hi. I can't seem to get this median function to work, and it returns the following error message.

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

Any help would be appreciated. Thank you!


One question immediately arises... Where is the if.


That was a typo after some troubleshooting. I have updated the screenshot. :slight_smile:


nums = nums.sort()

will be None since there is no return value. Use,



nums = sorted(nums)