Can any one explain for me how lexicographically (alphabetical order) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can any one explain for me how lexicographically (alphabetical order)

alphabetical order ? how that look a like

24th Jan 2017, 7:36 PM
Hesham Taha ElSaid Hassan Kamal-ElDain
Hesham Taha ElSaid Hassan Kamal-ElDain - avatar
2 Answers
+ 2
In python, do something like this (sort(*, key=None, reverse=None)) Example for alphabetical list could be like this sorted(sorted(s), key=str.upper) It's also possible with lambda as such text='aAaBbcCdE' sorted(text,key=lambda x:(str.lower(x),x)) But this is deprecated, slow and not recomended To learn more about sorting you can look here https://docs.python.org/3.6/howto/sorting.html I'm just assuming you are using python 3.
24th Jan 2017, 7:46 PM
Alex
Alex - avatar
+ 1
try the following code to understand it in simple way print("abc" >="efg") print("pqr">="efg") as ABC is the beginning of the alphabetical series we get first statement result as false and second statement result as true
1st Feb 2017, 3:19 PM
karthiga