Skip to content
Sign upLog in
← Back to Community

adding a list to a list

Profile icon
BananaJellyfish

i have a list
a = 'pistol
b = 'ak-47'
weapons = [a, b]
but when i try to add them to my owned_items list:
owned_items.append(weapons)
it comes up with:

image

Answered by 19ecal [earned 5 cycles]
View Answer
Voters
Profile icon
BananaJellyfish
Comments
hotnewtop
Profile icon
19ecal

I think this is because you are trying to add to a string as though it is a list. Try doing at line 40 owned_items=[] and set it as an empty list.

Profile icon
BananaJellyfish

@19ecal
thanks!

Profile icon
Wumi4

Hmmm... The error doesn't help us much, can you show the Repl?

Profile icon
BananaJellyfish
Profile icon
BananaJellyfish

@Wumi4
oh yeah, press '1' at the start btw