What gets printed:
a = b = [1, 2, 3]
b[2] = 4
Variables a and b are lists in this example. But they point to the same memory area.
Python list datatype is mutable (meaning that it can be modified in place).
Since both variables point to the same data and it can be modified in place, then after variable b is updated, variable a will change as well.

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Продолжайте изучать
тесты по Python
Зарегистрируйся сейчас
или Подпишись на будущие тесты