Assignment Operators (असाइनमेंट ऑपरेटर) :-
Assignment Operators (असाइनमेंट ऑपरेटर) वे Operators हैं जिनका उपयोग किसी value या expression का result किसी variable में assign (निर्धारित/संग्रहित) करने के लिए किया जाता है।
Python में Assignment Operators का उपयोग variables को value देने तथा किसी variable की value को update (बदलने) करने के लिए किया जाता है।
English
Assignment Operators are used to assign a value or the result of an expression to a variable.
They are also used to update the value of a variable using arithmetic operations such as addition, subtraction, multiplication, division, etc.
1. Assignment Operator (=) :-
The Assignment Operator (=) is used to assign a value to a variable.
Assignment Operator (=) का उपयोग किसी variable में value store/assign करने के लिए किया जाता है।
Syntax -
The Add and Assign Operator (+=) adds a value to the existing value of a variable and assigns the result back to the same variable.
Add and Assign Operator (+=) variable की existing value में नई value को जोड़ता है और result को उसी variable में store करता है।
Syntax -The Subtract and Assign Operator (-=) subtracts a value from the existing value of a variable and assigns the result back to the same variable.
Subtract and Assign Operator (-=) variable की existing value में से नई value को घटाता है और result को उसी variable में store करता है।
Syntax -The Multiply and Assign Operator (*=) multiplies the existing value of a variable by a given value and assigns the result back to the same variable.
Multiply and Assign Operator (*=) variable की existing value को दी गई value से multiply करता है और result को उसी variable में store करता है।
Syntax -The Divide and Assign Operator (/=) divides the existing value of a variable by a given value and assigns the result back to the same variable.
Divide and Assign Operator (/=) variable की existing value को दी गई value से divide करता है और result को उसी variable में store करता है।
Syntax -The Modulus and Assign Operator (%=) calculates the remainder and assigns it back to the variable.
Modulus and Assign Operator (%=) भाग करने के बाद प्राप्त remainder (शेषफल) को variable में store करता है।
Syntax -The Floor Division and Assign Operator (//=) performs floor division and assigns the result back to the variable.
Floor Division and Assign Operator (//=) floor division करता है और प्राप्त result को उसी variable में store करता है।
Syntax -The Exponentiation and Assign Operator (**=) raises the variable to the given power and assigns the result back to the variable.
Exponentiation and Assign Operator (**=) variable की value पर power/घात लगाता है और result को उसी variable में store करता है।
Syntax -
Output -