+ 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 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
5th Dec 2021, 5:44 PM
Per Bratthammar
Per Bratthammar - avatar