e042: P52 邏輯運算子 03_01
Tags : Python
Accepted rate : 0人/0人 (0%) [非即時]
評分方式:
Tolerant

最近更新 : 2024-12-27 13:38

Content

當一個運算式要同時存在兩個以上的關係運算子時,每兩個關係運算子之間必須使用邏輯運算子連結

(1) not
邏輯not是將「True」轉為「False」,「False」轉為「True」。

(2) and
邏輯and是兩件事都True,結果才是True,其餘都是False

(3) or
邏輯or是於兩件事件中,只要有一件為True,那就為True,只有兩件事全
為False,才為False

x = 3
y = 4
print(not(x == y))  # True
print(x > 0 and y > 0)  # True
print(x > 0 or x == y)  # True

Input
Output
Sample Input #1


											
										
Sample Output #1
True
True
True
測資資訊:
記憶體限制: 64 MB
公開 測資點#0 (100%): 1.0s , <1K
Hint :
Tags:
Python
出處:
[管理者: zero(育達管理員) ]


ID User Problem Subject Hit Post Date
沒有發現任何「解題報告」