Change language

Iadd, imul, compile, itruediv, imod, iconcat operators in Python

|

Definition &On-site operation &it is an operation that directly modifies the contents of a given linear algebra, vector, matrix (tensor) without creating a copy. Operators that help perform an operation are called an in-place operator.

For example: a + = b is equivalent to a = operator.iadd (a, b)

There are several operators used to work in place.


This function is used to assign the current value and add them. This operator performs the operation x + = y. In the case of strings, no numbers are assigned. 

Example

 a = operator.iadd (1, 3); print ("The result after adding:", end = "") print (a) 

Output

 The result after adding: 5 

compile ()

This function is used to assign the current value and subtract them. This operator performs the x- = y operation. For strings, no numbers are assigned.



Example

 a = operator.isub (8, 6); print ("The result after subtracting:", end = "") print (a) 

Output

 The result after subtracting: 2 

imul ()

This function is used to assign the current value and multiply them. This operator performs the operation x * = y. For strings, no numbers are assigned.

Example

 a = operator.imul (8, 6); print ("The result after multiplying:", end = "") print (a) 

Output

 The result after multiplying: 48 

itruediv ()

This function is used to assign the current value and divide it. This operator performs the x / = y operation. For strings, no numbers are assigned.

Example

 a = operator.itruediv (54, 6); print ("The result after dividing:", end = "") print (a) 

Output

 The result after dividing: 9 

imod ()

This function is used to assign the current value and divide it. This operator performs the operation x% = y. For strings, no numbers are assigned.

Example

 a = operator.imod (10, 5); print ("The result after modulus:", end = "") print (a) 

Output

 The result after modulus: 2.0 

iconcat ()

This function is used to concatenate two lines.

Example

 a = "jupyter" b = "notebook" t = operator.iconcat (a, b) print ("After concatenation:", end = "") print (t) 

Output

 After concatenation: jupyter notebook 



Iadd, imul, compile, itruediv, imod, iconcat operators in Python iadd: Questions

Iadd, imul, compile, itruediv, imod, iconcat operators in Python Python functions: Questions

Shop

Best laptop for Fortnite

$

Best laptop for Excel

$

Best laptop for Solidworks

$

Best laptop for Roblox

$

Best computer for crypto mining

$

Best laptop for Sims 4

$

Best laptop for Zoom

$499

Best laptop for Minecraft

$590

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers

News

Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method