Source Code:
(back to article)
# Arithmetic operators x = 10 y = 5 print(x + y) # Addition print(x - y) # Subtraction print(x * y) # Multiplication print(x / y) # Division print(x % y) # Modulus print(x ** y) # Exponentiation # Comparison operators a = 10 b = 20 print(a == b) # Equal to print(a != b) # Not equal to print(a > b) # Greater than print(a < b) # Less than print(a >= b) # Greater than or equal to print(a <= b) # Less than or equal to # Logical operators p = True q = False print(p and q) # Logical AND print(p or q) # Logical OR print(not p) # Logical NOT
Result:
Report an issue