Python and Keyword

❮ Python Keywords


Example

Return True if both statements are True:

x = (5 > 3 and 5 < 10)

print(x)
Try it Yourself »

Definition and Usage

The and keyword is a logical operator.

Logical operators are used to combine conditional statements.

The return value will only be True if both statements return True, otherwise it will return False.


More Examples

Example

Using the and keyword in an if statement:

if 5 > 3 and 5 < 10:
  print("Both statements are True")
else:
  print("At least one of the statements are False")
Try it Yourself »

Related Pages

The keywords or, and not are also logical operators.

Read more about operators in our Python Operators Tutorial.


❮ Python Keywords

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.