The assignment expression, also known as the walrus operator (:=), was introduced in Python 3.8. An assignment expression performs assignment, while also returning the assigned value from the expression. This allows you to store and test a value in the same line.
temps = [56, 72, 65, 77, 73]
if ((average := sum(temps) / len(temps)) > 80):
print("It sure is warm!")
elif (average < 50):
print("It's quite cold.")