'Search string in list not working as expected

I'm creating a project in Python where I have a list of strings as follows:

lst_characters = ['Abel', 'Abigail', 'Adon', 'Akira', 'Akuma', 'Alex', 'Balrog', 'Birdie', 'Blanka', 'C. Viper']

Then, I'm checking if a given string "let's say: Akuma (foe)" is in lst_characters.

The way I'm doing it is:

# Sample string to check if exists in the list: 
character = "Akuma (foe)"

# Lower all strings in the list: 
lst_characters = [x.lower().strip() for x in lst_characters]

# Lower the sample string and check if exists in the list: 
if (character.lower() in lst_characters): 
    print("Character (" + character + ") is in the list")
else: 
    print("Character (" + character + ") not found in the list")

And the result is:

Character (Akuma (foe)) not found in the list

You can run this code here - mycompiler.io.

I tried this code - "using any" and this code - using map and none of the code shown in the answers shows me the desired result, that is:

Show that there is an element called (Akuma) in the lst_characters that matches with the sample input Akuma (foe).



Solution 1:[1]

if (character.lower() in lst_characters): 

to

if ((character.split())[0].lower() in lst_characters): 

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Will Jordan