0
why is it print 100 first please help
the = ['Kiwi', 'Orange', 'mango', '44', '15', '100'] the.sort() print(the)
3 Answers
+ 5
Because strings are sorted lexicographically by default.
+ 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
+ 4
It means they are sorted by their ASCII values
Check this out for reference:
https://code.sololearn.com/cGh63mKrL4iT/?ref=app