I saw another use expand their code to add some user input functionality. I decided to take it one step further and add some error detection. I would like to have python check to see if the user inputs anything at all and if that option is in the list. Here is my code, how would I have python check if the input is in the list?
backpack = ['xylophone', 'dagger', 'tent', 'bread loaf'] print backpack delete = raw_input('What would you like to remove from your backpack?') if len(delete) > 0 and item = delete.lower() backpack.remove(item) print backpack else: print "You did not make a valid selection!"