+ 2

Can't understand the description

Greater than and smaller than operators can also be used to compare strings lexicographically (the alphabetical order of words is based on the alphabetical order of their component letters).

6th Jun 2018, 8:10 PM
Mac Alvin
Mac Alvin - avatar
3 Answers
+ 5
You're using Python, right? Lexicographically means the way words are alphabetically ordered based on the alphabetical order of their letters. For example: print("a" > "b") # Outputs False because "b" comes after "a" in the alphabet, so "b" is greater than "a" print("a" < "b") # Outputs True print("ab" > "ac") # Outputs False because "c" comes after "b" in the alphabet, so it makes the whole word "ac" greater than the word "ab"
6th Jun 2018, 10:58 PM
Pao
Pao - avatar
+ 3
just didn't understand the order and whether complete words could be used, now I know thanks to Pao
7th Jun 2018, 3:39 AM
Mac Alvin
Mac Alvin - avatar
0
You can't understand the description of lexicographically?
6th Jun 2018, 8:32 PM
J.G.
J.G. - avatar