Python walrus operator := 🦦

Published: 04 January 2021
on channel: Bro Code
26,635
1.4k

Python walrus operator assignment expression tutorial example explained

#python #walrus operator

walrus operator :=

new to Python 3.8
assignment expression aka walrus operator
assigns values to variables as part of a larger expression

happy = True
print(happy)

print(happy := True)

foods = list()
while True:
food = input("What food do you like?: ")
if food == "quit":
break
foods.append(food)

foods = list()
while (food := input("What food do you like?: ")) != "quit":
foods.append(food)


On this page of the site you can watch the video online Python walrus operator := 🦦 with a duration of hours minute second in good quality, which was uploaded by the user Bro Code 04 January 2021, share the link with friends and acquaintances, this video has already been watched 26,635 times on youtube and it was liked by 1.4 thousand viewers. Enjoy your viewing!