Can Python use the same command twice?

hi,

sory for the question, it might seem stupid, i’m new to programing, but i curious.

is there any command for same command like execute twice?

for example when hit ogre, and you need to hit twice you use
hero.attack(enemy)
hero.attack(enemy)
(if i’m not mistaken)

i wondering is there any command for that in single line?

appreciate the input.

sorry for language

:slight_smile:

yes. like

MoveRight
MoveRight

As far as I remember on the beginnning levels there was something like

MoveRight
MoveRight

–>

MoveRight(2)

Try it, it should work.

no i mean like
hero.attack(enemy)
hero.attack(enemy)

because
hero.attack(enemy) (2) nor hero.attack{(enemy) (2)}

dont work

May I have a direct lvl link? Like https://codecombat.com/play/level/shadow-guard?

https://codecombat.com/play/level/true-names?

if you see in the brief, it says
attack Brak twice, ergo the command i learn is
hero.attack(“Brak”)
hero.attack(“Brak”)

but that’s two command line. what i’m curious is. can it done in 1 single line?

as far as i know it cant be possible

So am I, so questions are ok)

Looks like

hero.attack(“Brak”)

is command, and

MoveRight

is function, so (2) work fine with [MoveRight] and doesn’t with [hero.attack(“Brak”)].

You can make some tricks and win like:

But I’m not sure you have Programmaticon for defining functions (

With this trick you can make level witn 5 lines of code.

1 Like

Well, it’s possible with original question about game hardcoded functions like [hero.attack(enemy)], [MoveRight] etc. And I think I found a way to make it with player-specified commands kinda hero.attack(“Brak”) )

Just thought about smthng. Gonna PM )