邏輯運算子

  1. 邏輯(logical)運算子,主要用在組合判斷狀況。
    [dywang@kvm8 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.
    >>> x=7
    >>> x<10 and x>5
    True
    >>> x<5 or x>10
    False
    >>> not(x<5 or x>10)
    True
    >>> quit()