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 Mutability

I am coping Craig's code but when I run it it doesnt work. It keeps white. Could you help me please?

books = [ "Automate the Boring Stuff with Python: Practical Programming for Total Beginners - Al Sweigart", "Python for Data Analysis", "Fluent Python: Clear, Concise, and Effective Programming - Luciano Ramalho", "Python for Kids: A Playful Introduction To Programming - Jason R. Briggs", "Hello Web App: Learn How to Build a Web App - Tracy Osborn", ]

video_games = [ "The Legend of Zelda: Breath of the Wild", "Splatoon 2", "Super Mario Odyssey", ]

def display_wishlist(display_name, wishes): print(display_name + ":") suggested_gift = wishes.pop(0) print("======>", suggested_gift, "<=====") for wish in wishes: print("* " + wish) print()

display_wishlist("Books", books)
display_wishlist("Video Games" , video_games)

2 Answers

Armin Halilovic
Armin Halilovic
3,372 Points

HI Nicolas Caplan

Did you check for the correct formatting of the code? Python is extremely sensitive regarding the formatting (spaces) of the code.

I have copied your code and it is working without any issues

books = [ "Automate the Boring Stuff with Python: Practical Programming for Total Beginners - Al Sweigart", "Python for Data Analysis", "Fluent Python: Clear, Concise, and Effective Programming - Luciano Ramalho", "Python for Kids: A Playful Introduction To Programming - Jason R. Briggs", "Hello Web App: Learn How to Build a Web App - Tracy Osborn", ]

video_games = [ "The Legend of Zelda: Breath of the Wild", "Splatoon 2", "Super Mario Odyssey", ]

def display_wishlist(display_name, wishes): 
  print(display_name + ":") 
  suggested_gift = wishes.pop(0) 
  print("======>", suggested_gift, "<=====") 
  for wish in wishes: 
    print("* " + wish) 
    print()

display_wishlist("Books", books)
display_wishlist("Video Games" , video_games)

Make sure to have the code exactly like this. And make sure so save the file before running it in the workspace console.

Maybe consider going through the basics course again if you find yourself "lost" or if you have trouble with it.

Best Regards

Susanne Salce
Susanne Salce
2,006 Points

This helped I was having issues with my code for the display_wishlist portion, thank you so much!

books = [ "Automate the Boring Stuff with Python: Practical Programming for Total Beginners - Al Sweigart", "Python for Data Analysis", "Fluent Python: Clear, Concise, and Effective Programming - Luciano Ramalho", "Python for Kids: A Playful Introduction To Programming - Jason R. Briggs", "Hello Web App: Learn How to Build a Web App - Tracy Osborn", ]

video_games = [ "The Legend of Zelda: Breath of the Wild", "Splatoon 2", "Super Mario Odyssey", ]

def display_wishlist(display_name, wishes): print(display_name + ":") suggested_gift = wishes.pop(0) print("======>", suggested_gift, "<=====") for wish in wishes: print("* " + wish) print()

display_wishlist("Books", books)
display_wishlist("Video Games" , video_games)