Python and 關鍵字
定義和用法
and 關鍵字是邏輯運算符。
邏輯運算符用于組合條件語句。
如果兩條語句都返回 True,則返回值將為 True,否則返回 False。
更多實例
實例
在 if 語句中使用 and 關鍵字:
if 5 > 3 and 5 < 10: print("Both statements are True") else: print("At least one of the statements are False")
and 關鍵字是邏輯運算符。
邏輯運算符用于組合條件語句。
如果兩條語句都返回 True,則返回值將為 True,否則返回 False。
在 if 語句中使用 and 關鍵字:
if 5 > 3 and 5 < 10: print("Both statements are True") else: print("At least one of the statements are False")