What does the walrus operator (:=) do in Python 3.8+?

Python Developer Medium

Python Developer — Medium

What does the walrus operator (:=) do in Python 3.8+?

Key points

  • The walrus operator is used for assignment within an expression
  • It returns the assigned value
  • Enhances code readability and conciseness
  • Introduced in Python 3.8

Ready to go further?

Related questions