0

Explain the output

Could anyone explain the output for this print statement.... I don’t understand why it return “r” print(max("SoloLearn"))

12th Mar 2019, 12:48 AM
Dave Merrique
Dave Merrique - avatar
2 Answers
+ 3
When comparing strings the maximum of them is the one that has the highest ASCII value. ASCII("S") = 83 ASCII("o") = 111 ASCII("l") = 108 ASCII("L") = 76 ASCII("e") = 101 ASCII("a") = 97 ASCII("r") = 114 ASCII("n") = 110. Thus, "r" is returned.
12th Mar 2019, 2:30 AM
Diego
Diego - avatar
0
wow!!!! I had to google ASII
12th Mar 2019, 4:09 PM
Dave Merrique
Dave Merrique - avatar