soo I have a problem. I would like to sort a list, with an other list inside (which contains numbers and text) by numbers but if there are 2 same numbers then sort should not sort by text, in other words, let the sort skip text.
My code:
nums = [[4,'w'],[4,'a'],[2,'a']]
print(sorted(nums))
Result:
[[2, 'a'], [4, 'a'], [4, 'w']]
What I want to have:
[[2, 'a'], [4, 'w'], [4, 'a']]
As you can see, in "what I want to have" the [4,'w']
and [4,'a']
have not changed places, but they have changed places during sorting
Please help me recieve "what I want to have"
And sorry for my bad English, I'm not an English native speaker