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
JavaScript
x
9
1
l = ['Assassin Bow', 'Bone Bow', 'Citadel Bow']
2
s = 'Bone Bow of Fire'
3
4
# loop through each element in list 'l'
5
for x in l:
6
# if the element is somewhere in the string 's'
7
if x in s:
8
print(x)
9