If the string has a (4658") it is the smallest value How can I make a function that returns 4568?
python
You can use it with min(map(int,"4658)).
I think I'm asking a question about sorting. The small value eventually comes in the first place.
int(''.join(sorted('4658')))
sorted('4658') # ['4', '5', '6', '8'] Sorting each character.
'.join (['4', '5', '6', '8']) # Make the list a string '4568'.
int('4568') # Transform into an integer.
© 2024 OneMinuteCode. All rights reserved.