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,357 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

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)