May-05-2017, 10:14 PM
(This post was last modified: May-05-2017, 10:27 PM by Liquid_Ocelot.)
(May-05-2017, 10:12 PM)ichabod801 Wrote: You're already prompting for a string, so you know how to do that. To see if a word or phrase is in a given title, you use the in operator:
if 'aid' in 'Raiders of the Lost Ark': print('match')If you want to make that case insensitive, the standard way is to use the upper method of the two strings, which makes them both upper case. To check against all of the movie titles, you would loop through them, check each one. You could print each one as you find it, or append it to a list in case you wanted the matches for later processing.
Maybe ive been staring blankly at the code for too long haha thanks. Makes sense
So if I was to do this
if selection =='s': search = str(input("Please enter a string to search")) if search in ([movies_list]): print(movies_list.index)What would I need to change in order for it to display the strings that contain the user input?