Question #947

What Python version introduced the walrus operator?

Python 3.8 introduced assignment expressions, written with a new operator := . This operator is also known as the walrus operator as it resembles the eyes and tusks of a walrus on its side. Assignment expressions allow to assign and use an object in one line.

print(walrus := True)


Comment on Disqus:

Comment on Twitter:

Question difficulty: πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅