+ 2
What is the difference between these two lines in Python? 👇👇👇
a, b=0,1 #Give value to 2 variables in one line a=0 # Value to a variable in a line b=1
5 odpowiedzi
0
Thanks, guys. I found my answer here. Maybe it'll be useful for you, too.
https://stackoverflow.com/questions/23085008/JUMP_LINK__&&__python__&&__JUMP_LINK-usage-of-variables-and-their-difference-a-b-0-1-vs-a-0-b
+ 4
I think the difference between two line that the line one use Pythonic code
0
functionally they are identical. the first example could make your code slightly harder to read as it is less common to code that way. i prefer clean and simple code that’s easiest to read.
0
@amir that’s interesting, but different. there they are talking about assignment precedence. very interesting though.
0
Yes that's right. Unfortunately, I did not ask the right question