I have a list = [‘Assassin Bow’, ‘Bone Bow’, ‘Citadel Bow’] and I have a string = ‘Bone Bow of Fire’
How can I get output ‘Bone Bow’ as the result ? Just started codding, thx for understanding.
Advertisement
Answer
l = ['Assassin Bow', 'Bone Bow', 'Citadel Bow']
s = 'Bone Bow of Fire'
# loop through each element in list 'l'
for x in l:
# if the element is somewhere in the string 's'
if x in s:
print(x)