What is walrus opertors and what is use of that? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is walrus opertors and what is use of that?

Can any one plz explain?

13th Jun 2021, 5:25 PM
Jayasree
Jayasree - avatar
1 Answer
+ 2
For exemple: Python print (a := 10) # 10 print (a = 10) # TypeError ... Using this operator allows you to speed up and shorten your code. makes it possible to solve two problems at once: assign a value to a variable and return that value, so sometimes you can write the code shorter and make it more readable, and it can be even more computationally efficient
13th Jun 2021, 5:42 PM
SammE
SammE - avatar