Python a, b = b, a +b

前端 未结 7 2173
独厮守ぢ
独厮守ぢ 2020-11-28 07:24

This is my first question and I started to learn Python. Is there a difference between:

a, b = b, a + b

and

a = b
b = a +          


        
7条回答
  •  难免孤独
    2020-11-28 08:09

    a, b = b, a + b is similar to a, b = 0, 1 assigning values to both variables a, b at same time. First assign a = b and then b = a + b.

提交回复
热议问题