Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
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 up-
MightyIronElf 16
2,510 Points1 Answer
-
Blair Walker
12,672 Points1 Answer
-
Gerald Bishop
Python Development Techdegree Graduate 16,897 Points3 Answers
-
ja5on
10,338 Pointssince craigs alteration at 6:17 my display_name def parameter is not accessable is that intentional?
1 Answer
-
Leah Kelly
4,141 Points2 Answers
-
wc93
25,725 Points1 Answer
-
Cedric Lefrancois
1,776 Points4 Answers
-
Bao Trang
4,138 Pointswhat is the use of print() at the end of the display_wishlist function?
Posted by Bao TrangBao Trang
4,138 Points1 Answer
-
Tyler Mootz
2,972 Points1 Answer
-
Adrian Diaz
3,500 Points1 Answer
-
Joseph Michelini
Python Development Techdegree Graduate 18,692 Points4 Answers
-
Marcos Duran
Python Development Techdegree Student 3,052 Points2 Answers
-
Tsering Choedhen
1,051 Points3 Answers
-
Nicolas Caplan
780 PointsI am coping Craig's code but when I run it it doesnt work. It keeps white. Could you help me please?
2 Answers
-
Bruno Correia
3,114 PointsWhy is "sword" and "boomerang" left when deleting while iterating?
Posted by Bruno CorreiaBruno Correia
3,114 Points2 Answers
-
Magdalena Krzeszycha
1,522 Points2 Answers
View all discussions for this video
Related 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