Ask your own question, for FREE!
Computer Science 9 Online
OpenStudy (anonymous):

In python what is the difference between these two? sequence = range(10) buffer = sequence and sequence = range(10) buffer = [item for item in sequence]

OpenStudy (asnaseer):

in the first one, you are creating an alias called 'b' to 's' and therefore any changes to make to 'b' will also change the contents of 's' in the second one, you are using list comprehensions to create a separate copy of 's' in 'b'. so any changes in 'b' now will NOT be reflected in 's'.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Arriyanalol: i need help
1 day ago 7 Replies 1 Medal
Arriyanalol: CONGRATS to me
1 day ago 8 Replies 2 Medals
Legomaster346: What colleges are good that are near Arab Alabama?
1 week ago 5 Replies 0 Medals
Arriyanalol: i need help
1 week ago 6 Replies 2 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!