I get this error when I try to figure out the low and high prices for my BeautifulSoup web scraper. I attached the code below. Shouldn\'t my list be a list of ints?
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.
Your problem is the line:
intprices = intprices.sort()
The .sort()
method on a list operates on the list in-place, and returns None
. Just change it to:
intprices.sort()