Python .sort() not working as expected

前端 未结 8 933
南笙
南笙 2020-12-03 22:06

Tackling a few puzzle problems on a quiet Saturday night (wooohoo... not) and am struggling with sort(). The results aren\'t quite what I expect. The program iterates throug

8条回答
  •  忘掉有多难
    2020-12-03 22:34

    Your list contains strings so it is sorting them alphabetically - try converting the list to integers and then do the sort.

提交回复
热议问题