Stillness in Motion

I need the code answers for CS2 Stillness in Motion

We do not give out code in this board as it interferes with learning. Please post your code correctly and we’ll be more than happy to help from there.

while True:
    enemy = hero.findNearestEnemy()
    # If there is an enemy, then...
    if enemy:
        # Create a distance variable with distanceTo.
        # If the distance is less than 5 meters, then attack.
        # Else (the enemy is far away), then shield.
    # Else (there is no enemy)...
        # ... then move back to the X.
        hero.moveXY(40, 34)

you haven’t even tried to complete the code?! we can’t help you until you try.