0

why is it print 100 first please help

the = ['Kiwi', 'Orange', 'mango', '44', '15', '100'] the.sort() print(the)

10th Jul 2021, 6:22 AM
Harsh Kumar
Harsh Kumar - avatar
3 Antworten
+ 5
Because strings are sorted lexicographically by default.
10th Jul 2021, 6:30 AM
ChaoticDawg
ChaoticDawg - avatar
+ 5
Harsh Kumar , here is an other sample code, that prints out the word in letters followed by the word in ascii values. you can see the result when running the attached code: https://code.sololearn.com/cj5BRJ8PQ85W/?ref=app
10th Jul 2021, 10:56 AM
Lothar
Lothar - avatar
+ 4
It means they are sorted by their ASCII values Check this out for reference: https://code.sololearn.com/cGh63mKrL4iT/?ref=app
10th Jul 2021, 6:56 AM
Simba
Simba - avatar