+ 1
Please i don't understand walrus operator, comparison,booleans and if ,else and elif statement
2 odpowiedzi
+ 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