Clash of Clones: Nonexistent line error

Hey so I’m making a code to beat clash of clones, but when run the code I get the error message “Line 54: Unexpected Identifier” The strange thing there is no Line 54. As a note I’m not carrying a sword, instead using the bash function on my shield to prevent the clone from attacking. I’m also using a modified version of the code from lurkers with the shaman check as a sand-yak check.

enemies = self.findEnemies()
enemyIndex = 0
while enemyIndex < len(enemies):
    
  enemy = enemies[enemyIndex]
  if enemy.type ! 'Sand-Yak':
    while enemy.health > 0:
        if self.isReady("Bash"):
          self.bash(enemy)
        else:
            self.shield()           
  enemyIndex = enemyIndex + 1    

The error displayer isn’t exactly the smartest thing in the world. There are a few things wrong with your code, which could contribute to this error.

The line if enemy.type ! "Sand-Yak": contains the errors in question. The ! by itself doesn’t do anything, perhaps you meant !=? Also, the types never have any capital letters.

Hmm, seems strange for it to be on line 54 when there isn’t. First, I think on line 10 you need to slide self.shield() over 1. And on line 5, you have ! ‘Sand-Yak’ : Is that intentional?

Thank you. I will fix the sand yak error once I get back to school. Im currently banned off the computer by my mom so I have to wait for study hall at school.