Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
Lists are mutable. You should be careful when passing them around or using them in loops. Let's explore why!
Slicing
Slicing allows you to specify a range of elements from within a list. We will go over them in great detail in a bit. Here's a sneak peek (search for slicing).
Here's the solution using slices
def display_wishlist(display_name, wishes):
print("====> Suggested gift:", wishes[0], "<=====")
# Return a slice of the list from the 2nd element on...
for wish in wishes[1:]:
print("* " + wish)
print()
Learn More
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up