SythraOpen app

Operators and Operands in Python

In Python, operators are symbols (and some keywords) that perform computations; operands are the values they act on. Families include arithmetic, comparison, logical, assignment, membership, and identity.

Sythra

9 min read

XLinkedIn
Operators and Operands in Python — cover illustration

Want to understand operators and operands in Python? Operators are the symbols that make values interact — add, compare, assign, check membership. The values they act on are the operands.

Until values sit alone, little happens. Programming begins when values combine. This page is the map of Python’s operator families: arithmetic, comparison, logical, assignment, membership, identity — plus a brief nod to bitwise. For a deeper treatment of and / or / not, see Logical Operators in Python.

What you will learn

By the end you can:

  • Define operator vs operand
  • Use arithmetic operators including /, //, %, and **
  • Compare values with ==, !=, <, >, <=, >=
  • Combine conditions with and, or, not (overview)
  • Update names with compound assignment (+=, -=, …)
  • Check membership (in) and identity (is) — and know they differ from ==

This is an overview of operator families, not a deep dive into short-circuiting, truthiness, or bitwise math. Bitwise operators are named only; logical operators get a full leaf of their own.

Operators and operands — the action and the actors

Operators are special symbols (and a few keywords) that tell Python to perform a computation. Think of them as verbs. If values are nouns, operators are the actions that connect them. The values being acted on are called operands.

20 + 30
  • + is the operator
  • 20 and 30 are the operands

Not every operator is about math. Some compare. Some assign. Some check logic, membership, or identity. Below is each family.

Arithmetic operators

These perform numerical calculations.

OperatorMeaningExampleResult
+Addition10 + 515
-Subtraction10 - 55
*Multiplication10 * 550
/True division10 / 42.5
//Floor division10 // 42
%Modulo (remainder)10 % 42
**Exponentiation2 ** 38

True division vs floor division

In Python 3, / always returns a float — even when both operands are ints:

print(10 / 4)   # 2.5
print(10 // 4)  # 2

// is floor division: it discards the fractional part toward negative infinity. For positive numbers that looks like “cut off the decimal” — it does not round to nearest.

Modulo (%)

Modulo gives the remainder after division:

print(10 % 4)  # 2  because 10 = (4 * 2) + 2
print(7 % 2)   # 1  → odd

Common uses: even/odd checks, cyclic counters, wrapping indices.

Comparison operators

These compare values and return True or False — boolean results you will later use in if statements.

OperatorMeaningExample
==Equal to5 == 5 → True
!=Not equal5 != 3 → True
>Greater than10 > 5 → True
<Less than3 < 8 → True
>=Greater or equal5 >= 5 → True
<=Less or equal4 <= 10 → True

Logical operators (overview)

Used to combine or invert conditions:

print(True and False)  # False — both must be True
print(True or False)   # True  — at least one True
print(not True)        # False — reverses the result

That is enough for this map. Short-circuit evaluation, truthiness, and and vs & live on the dedicated page: Logical Operators in Python.

Assignment operators

Basic assignment stores a value under a name (see Variables in Python):

x = 5

Compound assignment updates a variable in place:

x = 5
x += 3   # same as x = x + 3

x -= 2
x *= 4
x /= 2
x //= 3
x %= 2
x **= 2

Membership operators

Check whether a value exists inside a sequence (list, string, and later other containers):

print(3 in [1, 2, 3])       # True
print(5 not in [1, 2, 3])   # True
print("a" in "cat")         # True

Identity operators

These check whether two names refer to the same object in memory — not merely equal values:

a = [1, 2]
b = a
print(a is b)      # True  — same object
print(a is not b)  # False

Bitwise operators (brief mention)

These work at the binary level: &, |, ^, ~, <<, >>. They show up in low-level work and some optimizations. You do not need them to start writing everyday Python — know they exist, then move on.

Big-picture summary

CategoryPurpose
ArithmeticMathematical operations
ComparisonReturns True / False
LogicalCombines conditions
AssignmentAssigns and updates values
MembershipChecks presence in a sequence
IdentityChecks memory identity
BitwiseOperates at the binary level

Operators are not just symbols. They decide how values combine, how logic flows, and how programs behave. Once they click, you start thinking in expressions — not only in isolated statements.

Common mistakes

  • Using = when you meant ==
  • Expecting / to return an int (it returns a float in Python 3)
  • Confusing // with rounding
  • Treating is like ==
  • Using bitwise & / | when you meant logical and / or

Common questions

What are operators and operands in Python?

Operators are symbols or keywords that perform a computation. Operands are the values those operators act on. In 20 + 30, + is the operator and 20 and 30 are the operands.

What is the difference between / and // in Python?

In Python 3, / is true division and always returns a float (10 / 4 is 2.5). // is floor division and discards the fractional part toward negative infinity (10 // 4 is 2).

What does the % operator do in Python?

The % operator returns the remainder after division. For example, 10 % 4 is 2 because 10 = (4 × 2) + 2. It is often used for even/odd checks and cyclic counters.

What is the difference between == and = in Python?

== checks whether two values are equal and returns True or False. = assigns a value to a name. They are not interchangeable.

What is the difference between == and is in Python?

== compares values for equality. is checks whether two names refer to the same object in memory. Equal values are not always the same object.

What are membership operators in Python?

Membership operators are in and not in. They test whether a value appears in a sequence such as a list or string — for example, 3 in [1, 2, 3] is True.

Explore

Related topics

Keep going — these sit next to this concept in a real learning path.

Browse all python explainers →