+ 3
print(max("SoloLearn"))
Anyone can explain this for me? Why the solution is r?
4 Answers
+ 9
Here, max() function compares each character in the string lexicographically. The comparison is done based on each character's ASCII value (or Unicode value if it was a Unicode character). But the string "SoloLearn" contains no Unicode character.
See the following dictionary to understand how letter 'r' was considered as maximum (greatest) member of the string.
print( { letter : ord( letter ) for letter in "SoloLearn" } )
+ 4
There's a table we can refer to, here ...
https://www.asciitable.com/mobile/
+ 3
Thank you very much, so can I conclusion big letters have fewer value than small latters?
a > Z , a < z
+ 2
đđ