1. I remember the assignment order wrong

I used to think that the assignment was from right to left. Today, when LEetcode reviewed the algorithm, I found that I confused this notation

i = 0

def get_num() -> int:
    global i
    i = i + 1
  return i

a, b, c = get_num(), get_num(), get_num()
print(a, b, c)
Copy the code

The printed result is

1 2 3
Copy the code

2. Assignment logic is misremembered

a, b = 0, 1

a, b = 7, a + 0

print(a, b)
Copy the code

The printed result is

7 0
Copy the code

Not equal to the following part

a, b = 0, 1
a = 7
b = a + 0
print(a, b)

Copy the code

The printed result is

July 7Copy the code

Reference blogroll blog.csdn.net/JewelCCL/ar…