KnowledgeBoat Logo
|

Robotics & Artificial Intelligence

What is the difference between assignment operator and equality operator?

Getting Started

1 Like

Answer

The assignment operator (=) is used to assign a value to a variable, whereas the equality operator (==) is used to compare two values and returns True or False based on whether the values are equal.

Example:

a = 10      # assignment operator
b = 10

print(a == b)   # equality operator

Output:

True

Answered By

2 Likes


Related Questions