以下哪項是Pythonic? if not a and not b:
do_something
OR if not (a or b):
do something
它不是謂詞邏輯,所以我應該使用,因爲它更具有可讀性權Python的關鍵詞? 在後面的解決方案比其他更優化? (我不這麼認爲) 有沒有PEP-8指南?這兩種方法的 字節代碼(如果它的事項): In [43]: d
問題是: 假設p,q和r是布爾變量。請看下面的表達式: !(p && !q || r)
Which of the following expressions is equivalent to the given expression?
A. (p && r) || (!q && r)
B. (!p && !q) || (!p && r)
C. (!p || q) && !r
D. (!p