How do you fix this? [SOLVED]

image
my code

# Defeat as many ogres as you can.
# Use 'cast' and 'canCast' for spells.
while True:
    enemy = hero.findNearestEnemy()
    if hero.canCast("lightning-bolt") enemy and enemy:
        hero.cast("lightning-bolt", enemy)

the level ‘the one wizard’

hero.canCast("lightning-bolt", enemy) not hero.canCast("lightning-bolt") enemy

2 Likes

also, you need to put the and enemy before the canCast.

So enemy and hero.canCast("lightning-bolt", enemy)

2 Likes

i still get this error:image

What’s your new code?

nvm i fixed that (20)

# Defeat as many ogres as you can.
# Use 'cast' and 'canCast' for spells.
while True:
    enemy = hero.findNearestEnemy()
    if enemy and hero.canCast("lightning-bolt"):
        hero.cast("lightning-bolt", enemy)
1 Like

Mark the solution so the topic can be closed

1 Like

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.