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

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

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

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)

Mark the solution so the topic can be closed