Orge Gorge Gouger Bug and Help

Not sure if this is a bug or level help. But every time i try to beat this level it never loads.

my code:

while < 20: 
    while < 60:
        item = self.findNearest(self.findItems())
        coins = self.findItems()
        coinIndex = 0
        while coinIndex < len(coins):
            coin = coins[coinIndex]
            if coin.value > 1:
                self.moveXY(coin.pos.x, coin.pos.y)
            coinIndex += 1
    while self.pos.x > 16:
        self.move({'x': 15, 'y': 38})
    self.buildXY("fence", 21, 37)

Something very important to know: AVOID WHILE LOOPS

Your code is fine, its just that codecombat bugs when you have while loops

Maybe try making an if statement inside a while true loop

So for example:

while True:
    if hero.time < 20:
        # whatever you wanna do