Account
Categories

Floor Divide and Assign Operator (//=)


Definition:

The //= (floor division assignment operator) is used to divide the value of a variable by another number and update the same variable with the result.

It removes the decimal part and keeps only the integer (whole number).

Syntax:

variable //= value

Example:

rupees = 126
rupees //= 4

print(rupees)

Output:

Exercise

Create a variable money = 95 and divide it by 4 using the //= operator. Then print the result.