# How can we compare two strings?

In Python, you can do this:

"ab" > "ac"


which returns False.

In Mathematica, it doesn't evaluate.

But why? These are literal strings, not symbols.

• Just from the question description, I can not figure out what is comparing two strings. Mar 21, 2020 at 8:57
• But 1>2 works, there's also no indication of what is comparing two numbers. Mar 21, 2020 at 9:09
• With due respect, comparison of two numbers is common sense taught as early as in primary mathematics, but that of strings is not. Mar 21, 2020 at 13:44
• Number and string are both "atoms" in the language, so why are they treated differently in this case? Just because one is taught in primary school, and the other is not? Just wondering if there's a deeper reason for that. It seems odd a programming language would depend its design on school curriculum, rather than its own construct. Mar 22, 2020 at 3:26
• If strings should be comparable in the way of numbers, just because both of them are "atoms", so should symbols. Maybe this question should be forwarded to Wolfram himself :). Mar 22, 2020 at 3:36

AlphabeticOrder can compare strings alphabetically (or by other conventions used in dictionaries by various languages).