Python .sort() not working as expected

前端 未结 8 910
南笙
南笙 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条回答
  •  -上瘾入骨i
    2020-12-03 22:22

    The comparator operator is treating your input as strings instead of integers. In string comparsion 2 as the 3rd letter is lexically greater than 1. reversed = str(mult)[::-1]

提交回复
热议问题