Is this a bug?(SOLVED)

Lurkers in Sarven desert
My code:

while enemyIndex < len(enemies)
   enemy = enemies(enemyIndex)
   if enemy.type = 'shaman'
       while enemy.health > 0
            hero.attack(enemy)

and

enemyIndex += 1

The problem is when i click “run” or “submit” it just saying that the code never finished, it either rly slow or has an infinite loop

enemies doesn’t get defined,
enemyIndex doesn’t get defined

(enemyIndex) should be [enemyIndex]

= should be ==

Wait, the line 4,5 is

enemies = hero.findEnemies
enemyIndex = 0

also, i only change 2 line of code:

while enemyIndex < len(enemy)

and

enemyIndex += 1

other is pre-made

I see the problem, you should put : at the end of the line where the while-loops are and the if-statement

and make sure the increment line (enemyIndex += 1) is correctly indented

PS: welcome back

Guys i beat it.
My code doesnt have any problems.
It just my pc cant copy paste so i typed it.
Just go to github and find out we need to add 4 spaces in the “enemy index += 1” line.
Thank you for helping me

Ok! Please remember to mark the reply that helped as the solution. If none of them did, mark your own. If you can’t, just mark a random one as the solution. Thanks!

2 Likes

please dont use github code…

2 Likes