13/14 "Remove a Few Things"


#1

Hi to all:

I'm a little boring whit the practices so want to introduce string data on my backpack code for delete that input... so I'm tried something like the below... but is wrong :ghost:

backpack = ['xylophone', 'dagger', 'tent', 'bread loaf']
print 'Backpack list: '
print backpack
DELETE = raw_input('Select from the list which element want to delete?'))
backpack.remove(DELETE)
print 'NEW Backpack list: '
print backpack

How can I insert information... for then delete.?


#2

You can try this

backpack = ['xylophone', 'dagger', 'tent', 'bread loaf']
print 'Backpack list: '
print backpack
DELETE = raw_input('Select from the list which element want to delete?')
backpack.remove(DELETE)

INSERT = raw_input('Enter  element you want to insert?')
backpack.append(INSERT)

#this will  insert it at the psoition you wish
#backpack.insert(0, INSERT)

print 'NEW Backpack list: '
print backpack

#3

@rydan thanks for answer so quickly I forgot attach the error message from python

 File "python", line 4
    DELETE = raw_input('Select from the list which element want to delete?'))
                                                                            ^
SyntaxError: invalid syntax

#4

Yeah its the extra bracket you have in there


#5

JAJAJAJAJ yep.... I already noticed :joy: