Yang Hui Triangle problem in Python Printing

print Yang Hui triangle, each line is a list, output with generator. I use two lists, fac, to represent the current line, and pre to represent the previous line. Why is it that when you change the current line in the for loop, the previous line is changed to the same as the current line?

Nov.25,2021

this scripting language stores non-basic type variables with "references" or "pointers". When you initialize an array, don't initialize one and then the other is directly equal to the first array, such as

.
a = [ 0 ] * n
b = a

this will cause two variables to point to the same memory address, and changing one will also change

. Learn about mutable and immutable objects in

python.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b2b794-2b2e7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b2b794-2b2e7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?