Python Newbie 3

1. The walrus operator Walrus operator is the coolest feature that was added in the Python 3.8 update python codes. start = input("Do you want to start(y/n)?") print(start == "y") # double parentheses here # using parentheses with the walrus operator is encouraged print((start := input("Do you want to start(y/n)?")) == "y") # With parentheses if (sum := 10 + 5) > 10: print(sum) #return 15 # Without parentheses if sum := 10 + 5 > 10: print(sum) #return True a = [1, 2, 3, 4] if (n := len(a)) > 3: print(f"List is too long ({n} elements, expected <= 3)") 2....