Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Introducing Lists Using Lists Review Mutability

Mark Nembhard
Mark Nembhard
1,387 Points

Why are there so many copies in the taco joint question? It seems like the restaurants has been copied 3 times

I am looking at the code and it seems like the repetition is one two much

1 Answer

Steven Parker
Steven Parker
231,268 Points

There are two calls to "copy" in the example. The first creates "taco_joints" so it can be modified without affecting "restaurants", and the second one is for the loop to make sure the modification does not interfere with the iteration.

But you're right, the loop could have been based on "restaurants" instead of making another copy. Good eye!