比較運算子

  1. 假設 a=15 b=10
    pyuser@deyu ~/zzz$ python
    Python 3.12.9 (main, Aug 14 2025, 00:00:00) [GCC 14.2.1 20250110 (Red Hat 14.2.1-7)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> a=15
    >>> b=10
    >>> a==b
    False
    >>> a!=b
    True
    >>> a<>b     ## python2 與 != 相同,python3 不適用。
      File "<stdin>", line 1
        a<>b
          ^
    SyntaxError: invalid syntax
    >>> a>b
    True
    >>> a>=b
    True
    >>> a<b
    False
    >>> a<=b
    False
    >>> quit()