比較運算子

  1. 假設 a=15 b=10
    [dywang@deyu 10827000]$ python3
    Python 3.6.8 (default, Mar 19 2021, 05:13:41)
    [GCC 8.4.1 20200928 (Red Hat 8.4.1-1)] 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()