如何从以下列表中对总和数字进行排序

How to sort sum digits from the following list

list1 = [1236,985,150,641876,167]

我想知道如何按 的总和排序 Python.

输出按数字总和升序排序:

[150,1236,167,985,641876]

根据单位的位置对列表项进行排序。你可以试试:

list1 = [1236,985,150,641876,167] 
sorted(list1, key=lambda n: n%10)
[150, 985, 1236, 641876, 167]