How to sort the digits in int number in Python

1 Answer

0 votes
n = 76594

s = sorted(list(str(n)))

n = int("".join(s))

print(n)
        

  
  
'''
run:
  
45679
 
'''

 



answered Jun 9, 2020 by avibootz
...