Grokking Meta Coding Interview
Ask Author
Back to course home

0% completed

Vote For New Content
cannot use python list sort

camelBack

Jan 21, 2024

I am getting an error using python, trying to sort the list:

TypeError: 'Interval' object is not subscriptable

when I use either:

intervals.sort(key=lambda i: i[0])

OR

sorted(intervals, key=lambda i: i[0])

I can do this operation in my personal terminal with no issues

0

0

Comments
Comments
C
camelBack 2 years ago

Nevermind - the list items are class 'Interval.Interval'

On this page