How to sort the last 3 letters of a string in Python

1 Answer

0 votes
s = 'python'

part = s[3:]
part = ''.join(sorted(part))

s = s[:len(s) - 3] + part

print(s)    
 
 
'''
run:
 
pythno

'''

 



answered Sep 21, 2023 by avibootz
...