
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
What is the difference between = and == operators in Python?
In Python = symbol is defined as assignment operator. It requires one variable on its left and an expression on its right. Value of the expression on right is assigned to variable on left. Expression and name of variable are not interchangeable.
>>> a=10 >>> b=20 >>> c=a+b >>> a,b,c (10, 20, 30) >>> a+b=c SyntaxError: can't assign to operator
The == symbol is a comparison operator and called equal to operator. It returns true if operands on either side are equal, otherwise it returns false
>>> 10+2 == 10 False >>> (10+2) == 12 True >>> 'computer' == 'Computer' False >>> 'computer' == "computer" True
- Related Articles
- What is the difference between the != and operators in Python?
- What is the difference between | and || operators in c#?
- What is the difference between >> and >>> operators in Java?
- What is the difference between = and: = assignment operators?
- What is difference in Python operators != and "is not"?
- What is the difference between the | and || or operators in C#?
- What is the difference between prefix and postfix operators in C++?
- what is the main difference between '=' and '==' operators in javascript?
- What is the Difference Between Scala and Python?
- Difference between prefix and postfix operators in C#?
- Equality checks in Kotlin (Difference between "==" and "===" Operators)
- What is the difference between Core Python and Django Python?
- What is different in & and AND operators in Python?
- What is the difference between os.open and os.fdopen in python?
- What is the difference between attributes and properties in python?

Advertisements