共計 183 個字符,預計需要花費 1 分鐘才能閱讀完成。
在 Python 中,邏輯取反可以使用 not
關鍵字來實現。通過在要取反的表達式前添加 not
關鍵字,即可得到邏輯取反的結果。
例如:python
x = True
y = not x
print(y) # 輸出 False
z = not (x and y)
print(z) # 輸出 True
在上述例子中,not x
的結果是 False
,而not (x and y)
的結果是True
。
丸趣 TV 網 – 提供最優質的資源集合!
正文完