Skip to content
Advertisement

Combine two lists and sort them

Lets say I have two lists. I want to append list2 into list1 and then sort and add a new element at a specific index. I keep getting an error message saying:

TypeError: ‘<‘ not supported between instances of ‘list’ and ‘int’

This is what I have tried:

JavaScript

Advertisement

Answer

Use sorted() if you want to print sorted list:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement