The digits of a number in ascending order. (comparing) [closed]

You should not use key=int in c.sort(key=int) as c is already a list of ints due to you creating it via c.append(int(digit)).

However the key issue is that c.sort() is in-place and as such returns None, instead use sorted which returns a sorted list:

csort = sorted(c)

And then you can print the boolean result of the comparsion via:

print c == csort

Leave a Comment