Can’t sort my list because it is NoneType? Simple Python [duplicate]

intprices.sort() is sorting in place and returns None, while sorted( intprices ) creates a brand new sorted list from your list and returns it.

In your case, since you’re not wanting to keep intprices around in its original form simply doing intprices.sort() without reassigning will solve your issue.

Leave a Comment