0

I'm trying to print a list of my favorite games in addition to some text.

Code:

favGames = ["The Division", "WoW", "Legend of Zelda", "Super Smash Bros."]

print("Here are some of my favorite games! " + favGames)

Expectation: I expected to simply get a print line of:

Here are some of my favorite games! The Division, WoW, Legend of Zelda, Super Smash Bros.

I'm receiving the following error message: TypeError: can only concatenate list (not "str") to list

U13-Forward
  • 69,221
  • 14
  • 89
  • 114
Ebeeze
  • 25
  • 4

1 Answers1

1

Try using str.join, and join it by a command and a space:

print("Here are some of my favorite games! " + ', '.join(favGames))

Output:

Here are some of my favorite games! The Division, WoW, Legend of Zelda, Super Smash Bros.
U13-Forward
  • 69,221
  • 14
  • 89
  • 114