I’ve been working on in my name and I don’t know how to correct my code. There’s no other topics on this level, so I have no reference to base my code on. Help!
# You must to find the treasure. # This function should return the index of a letter: def letterIndex(word, letter): # Step through each letter as an index of the word. for letter in range(len(word)): # Store a character from the word with the current index. character = word # If it is the required letter: if character == letter: # Then return the current index (number). return len(word.index) # If nothing, return a default value return -1 ogreLetter = "z" shaman = hero.findByType("thoktar") # Find the index and use it for finding the treasure. chestIndex = letterIndex(shaman.id, ogreLetter) hero.moveXY(16 + chestIndex * 8, 36)