Forwarded from Learn Python Coding
Here's a small fact about Python 🐍
The
It was introduced in Python 3.8 and allows you to assign a value to a variable and use it directly within the expression at the same time.
For example:
Without it, you would have to retrieve the value separately using
Have you ever used the
#Python #Programming #WalrusOperator #Coding #TechFacts #Python3
✨ Join Best TG Channels https://t.iss.one/addlist/0f6vfFbEMdAwODBk
⭐️ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
The
:= operator is called the "walrus" because the symbols resemble the eyes and tusks of a walrus 🦭It was introduced in Python 3.8 and allows you to assign a value to a variable and use it directly within the expression at the same time.
For example:
while (line := input("Say something: ")) != "quit":
print(f"You said: {line}")Without it, you would have to retrieve the value separately using
input(), and then check it.Have you ever used the
:= operator in your code?#Python #Programming #WalrusOperator #Coding #TechFacts #Python3
✨ Join Best TG Channels https://t.iss.one/addlist/0f6vfFbEMdAwODBk
⭐️ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
Telegram
AI PYTHON 🌟
You’ve been invited to add the folder “AI PYTHON 🌟”, which includes 15 chats.
👍3❤2