Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

HELP: a problem about Array.pop()


I met a problem in the level GRIDMANCER.In line 35,i wanted to remove the first three items in the array COINS,so i used coins.pop(0) three times.But the result is the last three items are removed,where’s the problem?What should i do ,if i want to turn the array[0,1,2,8,9,10,18,19] to [8,9,10,18,19]?
Here is my code(python):
hero.say(hero.navGrid[0])
coins=
for j in range(20):
if hero.navGrid[0][j]==“Coin”:
#hero.say(j)
coins.append(j)
hero.say(""+coins)
for k in range(len(coins)-2):
if coins[k+1]-coins[k]==1:
continue
else:
hero.say(k)
hero.addRect(0, coins[0], 1, k+1)
m=0
while m<k+1:
coins.pop(0)#remove the last item?
m+=1
hero.say(""+coins)

Hi, I’m going to ask @Chaboi_3000 to help you because I can’t do this level.
Sorry,
Danny

Hi, please could you format your code. There are instructions on this topic: How to Post Your Code With Radiant, Harmonious Formatting.