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
1 Like
Related Questions
Write a Python program to demonstrate arithmetic operators in Python.
Explain relational operators in Python. Give one example for each.
What is the difference between division operator and floor division operator?
Write and evaluate the following expression in Python:
(a + b > c) and (a - b == -a + b), for a = 2, b = 3, c = 4