Important Notice:

Course Content
Operators, Expression & Python Statement (Chapter-4) M3-R5.1
About Lesson
Assignment Operators:-

                        Assignment Operator को ( = ) से represent करते हैं, जो कि value को किसी variable में assign करने के लिए use किया जाता है। हालाँकि इसे Arithmetic Operators के साथ भी use करते हैं।   

Operator

Name

Example

Description

=

Assign

x = y

यह बायीं तरफ के expression को वैल्यू assign करता है

+=

Addition then Assign

x += y

यह right operand को left operand से जोड़ता है तथा जो result आता है उसे left operand को assign करता है

-=

Subtract then Assign

x -= y

यह right operand को left operand में घटाता है तथा जो result आता है उसे left operand को assign करता है

/=

Divide then assign quotient with decimal point

x /= y

यह left operand को right operand से divide करता है तथा जो result आता है उसे left operand को assign करता है

* =

Multiplication then assign the product

x *= y

यह right operand को left operand में गुणा करता है तथा जो result आता है उसे left operand को assign करता है

% =

Divide then assign remainder

x %= y

यह दो operands का modulus लेता है और उसे left operand को assign करता है

// =

Divide then assign quotient without decimal

x //= y

यह operators में floor division को परफॉर्म करता है तथा उसे left operand को assign करता है

**=

Exponent AND

X**=y

यह operands में power (घात) को परफॉर्म करता है तथा उसे left operand को assign करता है

 

Note: किसी Unicode को Character में convert करने के लिए ord() तथा character को Unicode में convert करने के लिए chr() का प्रयोग करते हैं।

Question 1: wap to swap two number using third variable.

Question 2: wap to swap two number without using third variable.

Question 3: wap to convert any character to ASCII or Unicode.

Question 4: wap to convert Unicode or ASCII to Character.

 

Assignment Operators:-

                        Assignment operator is represented by (=), which is used to assign value to a variable. However, it is also used with Arithmetic Operators.

Operator

Name

Example

Description

=

Assign

x = y

This assigns a value to the expression on the left.

+=

Addition then Assign

x += y

It connects the right operand with the left operand and assigns the result to the left operand.

-=

Subtract then Assign

x -= y

It reduces the right operand to the left operand and assigns the result to the left operand.

/=

Divide then assign quotient with decimal point

x /= y

It divides the left operand by the right operand and assigns the result to the left operand.

* =

Multiplication then assign the product

x *= y

It multiplies the right operand with the left operand and assigns the result to the left operand.

% =

Divide then assign remainder

x %= y

It takes the modulus of two operands and assigns it to the left operand.

// =

Divide then assign quotient without decimal

x //= y

It performs floor division among operators and assigns it to the left operand.

**=

Exponent AND

X**=y

It performs power (to the power) on the operands and assigns it to the left operand.

 

Note: Ord() is used to convert Unicode into character and chr() is used to convert character into Unicode.

Question 1: wap to swap two number using third variable.

Question 2: wap to swap two number without using third variable.

Question 3: wap to convert any character to ASCII or Unicode.

Question 4: wap to convert Unicode or ASCII to Character.

error: Content is protected !!