# In this level you will use functions with two parameters.
# Look at the structure below, notice how there are two arguments.
# These are both accessible within the function.
def checkAndAttack(x, y):
# First move to the coordinates provided by the parameters
enemy = hero.findNearestEnemy()
hero.moveXY(x, y)
# Then check for an enemy.
if enemy:
hero.attack(enemy)
# If there is one, attack it!
pass
checkAndAttack(24, 42)
checkAndAttack(27, 60)
# Navigate to the last 3 x-marks and defeat any remaining munchkins.
checkAndAttack(42.50)
checkAndAttack(38,24)
checkAndAttack(55,29)
```Can anybody tell me what wrong with the line 8 (hero.moveXY(x, y)?
Thank
(hero.moveXY(x, y) # ==> You added another bracket at the beginning
# Delete the first bracket or otherwise add another one at the end
1 Like
checkAndAttack(42.50) # ==> a typo, change the period to the comma
1 Like
noted and thanks EpicCoder999
no problem! (20 chars)
still not working
Look at when you’re defining enemy, will the enemy be there when you check?
got it, level cleared. Thanks
he did add the if-statement