3

I saw a piece of code, which looks like this.

a=3
test: a=2
print(test) # test = 2
print(a)    # a = 3

I don't know why a remained unchanged, and test is assigned successfully.

Also, I found that if I do not define a in advance, there will be errors.

I don't know what the keyword of the syntax is as well as the purpose.

I hope that you can answer the question.

Nathan
  • 9,651
  • 4
  • 45
  • 65
楊雅涵
  • 39
  • 1

0 Answers0