ok, I have this code:
colors = ["Red" , "Green" , "Blue" , "Pink" , "Purple" , "Cyan"] search = str(raw_input()) found = "not" if search in colors: print "Found!" else: print "not Found"
so far, he can find one element in the list only if you enter a line in the terminal exactly as it is in the list, that is a problem.
I need to be able to type one or two characters in the terminal and have it so that it lists the lines inside the list that match the search (for example: if I were to enter "P" on the terminal, this is the list "Pink" and "Purple" , because they match my search so far, but not quite)
I can ignore something, but is there a way I can search the list this way without having more than 200 lines of code (200+ lines, because I need to implement this in order to have more than 150 lines in the list) just to search for the string ?
source share