#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    1
    Rep Power
    0

    Question about boolean results


    Given:
    a = 'test'
    b = 'test2'

    a<b gives True
    a>b gives False

    Why does a<b result in True and a>b gives False?
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,850
    Rep Power
    481
    In a dictionary of the English language, which word comes first?

    "a" or "anteater"?

    Your issue is string comparison.
    [code]Code tags[/code] are essential for python code and Makefiles!
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Location
    Egypt , Cairo
    Posts
    2
    Rep Power
    0

    Comparint text


    when you compare text you will find 'a' < 'b' < 'c' <.....'z'

    if you compare numbers as text you will find
    '1' < '2' < ...'9' < 'a' < 'b' < .........'z'

    and space ' ' < 1

IMN logo majestic logo threadwatch logo seochat tools logo