What is the assignment operator and how it works in python?

1.1K    Asked by shivaniChavan in Data Science , Asked on Jan 19, 2020
Answered by Nitin Solanki

 In python we ‘=’ sign to assign any value to a variable and this operator assigns right-hand side value to the variable written on the left side. But If the Arithmetic expression is written on the right-hand side of this operator then it will evaluate first that expression then assigns the value to a variable.

The left-hand side of the assignment statement must be a valid argument.

a = 5 # This is fine

3 = 4 # This is not fine

3 = a # This is not fine

a + b = 3 # This is also not fine



Your Answer

Interviews

Parent Categories