print('a'>'A')
why it shows "True" result what is the logic??
print('a'>'A')
why it shows "True" result what is the logic??
Look up the ordinals for these characters -- the position in the ASCII or Unicode table for each character or code point:
>>> ord('a')
97
>>> ord('A')
65
>>> print('a'>'A')
True
97 is greater than 65. Thus, a
comes after A
.
See Sort dictionary by key using locale/collation for discussion of how comparison can be done according to locale-specific collation order instead.