I have been trying to get past Medic School, but I keep getting an error. The screenshot and the script are below.
# Collect 10 mushrooms. # This function checks if the phrase starts with the word. def startsWith(phrase, word): # If the word is longer than the phrase, return False. if len(word) > len(phrase): return False # Loop through the indexes of word and phrase. for i in len(phrase): # If characters with the same index are different: if phrase[i] != word[i]: # Return False. return False # We checked all letters and they are the same. # Return True. return True def onHear(event): # Accept only options from experts. if startsWith(event.speaker.id, "Exp"): potion = pet.findNearestByType("potion") if potion: pet.fetch(potion) pet.moveXY(28, 34) pet.on("hear", onHear) while True: mushrooms = hero.findByType("mushroom") nearest = hero.findNearest(mushrooms) if nearest: hero.moveXY(nearest.pos.x, nearest.pos.y)
Any help will be appreciated,