Here you can find Arithmetic, Comparison, Logical Operators example of Python:

x = 12
y = 2

# Add two operands
print('x + y =', x+y) # Result: x + y = 14

# Subtract right operand from the left
print('x - y =', x-y) # Result: x - y = 10

# Multiply two operands
print('x * y =', x*y) # Result: x * y = 24

# Divide left operand by the right one 
print('x / y =', x/y) # Result: x / y = 6

# Floor division (quotient)
print('x // y =', x//y) # Result: x // y = 6

# Remainder of the division of left operand by the right
print('x % y =', x%y) # Result: x % y = 0

# Left operand raised to the power of right (x^y)
print('x ** y =', x**y) # Result: x ** y = 144
Please login or Register to submit your answer

Log In

Not the answer you are looking for? Browse other questions tagged or ask your own question.