0

Does (max) work for other types other than ints?

print(max(“Sololearn”)) Results in “r” which quite frankly I don’t understand at all... Thank y’all!

15th Aug 2019, 6:39 AM
ScienceLuke7
ScienceLuke7 - avatar
1 Answer
+ 3
It evaluates each character as it's corresponding Ascii code. So "a" is 97, etc. and in this case "r" has the largest Ascii code. Have a look: https://www.ascii-code.com/
15th Aug 2019, 6:47 AM
Paul Grasser
Paul Grasser - avatar