Python operators

The Python Walrus Operator

The Python walrus operator := assigns a value to a variable. But unlike assignment operator =, it also returns the assigned value. This extra feature makes it into an expression, which is a construct that produces a value. It allows the walrus operator to be used in contexts where an assignment and a value are both needed, such as within a conditional statement, loops and comprehensions.