In Python 3.8 was introduced an assignment expression (walrus operator :=) which can be used as in the example below.
if x := 1:
print(bool(x))The assignment statement cannot be used as in the previous example.
if x = 1: # syntax error
print(bool(x))More information here: