Good day!
Could you advise what’s wrong with my code? I couldn’t finish the level.
Thank you.
def isLetterInWord(word, letter):
for index in range(len(word)):
if word[index] == letter:
return True
return False
engineer = hero.findFriends()[0]
safeLetter = engineer.safeLetter
enemies = hero.findEnemies()
for index in range(len(enemies)):
enemy = enemies[index]
if isLetterInWord(enemy.id, safeLetter):
while enemy.health>0:
hero.attack(enemy)