in the end I looked for the solution to this exercise but am however still curious to know why exactly my code was given “NoneType object is not subscriptable”, that way I hopefully don’t repeat the same error. So this was my code:
Thank you @mtf and @appylpye for your help, I think I’m getting it now, thanks also to a reply I got on my other topic concerning NoneType. Later in the day I’ll go as well through the link appylpye provided.
The error is self-explanatory. You are trying to index None. You can not, because ‘NoneType’ object is not subscriptable. This means that you tried to do:
In general, the error means that you attempted to index an object that doesn’t have that functionality. You might have noticed that the method sort() that only modify the list have no return value printed – they return the default None. This is a design principle for all mutable data structures in Python.