Please i don't understand walrus operator, comparison,booleans and if ,else and elif statement | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Please i don't understand walrus operator, comparison,booleans and if ,else and elif statement

5th Dec 2021, 5:18 PM
Olatunji Emmanuel
Olatunji Emmanuel - avatar
2 Answers
+ 1
# Pretty much a half course… # But: The Walrus operator := is new from Python 3.8 and makes it possible to do an assignment inside an expression: >>> print(sum_ := 4 + 5, "-> square:", sum_ ** 2) 9 -> square: 81 # instead of: >>> sum_ = 4 + 5 >>> print(sum_, "-> square:", sum_ ** 2) 9 -> square: 81
5th Dec 2021, 5:44 PM
Per Bratthammar
Per Bratthammar - avatar