potionsOnTheWall = 10
numToTakeDown = 1
while True:
self.say(potionsOnTheWall + " potions of health on the wall!")
# Sing the next line:
self.say(potionsOnTheWall + " potions of helth!")
# Sing the next line:
self.say(“Take " + numToTakeDown + " down, pass it around!”)
potionsOnTheWall -= numToTakeDown
# Sing the last line:
self.say(potionsOnTheWall + " potions of health on the wall.")
And my code does not work. An error in the 5 iteration. What am I doing wrong?
Thaks
potionsOnTheWall = 10
numToTakeDown = 1
loop:
self.say(potionsOnTheWall + " potions of health on the wall!")
self.say(potionsOnTheWall + " potions of health!")
self.say(“Take " + numToTakeDown + " down, pass it arround!”)
potionsOnTheWall -= numToTakeDown
self.say(potionsOnTheWall + " potions of health on the wall.")
what am i doing wrong anybody have a code i can borrow that is javascript
loop {
var potionsOnTheWall = 10;
var numToTakeDown = 1;
this.say(potionsOnTheWall + " potions of health on the wall!");
this.say(potionsOnTheWall + " potions of health!");
this.say(“Take " + numToTakeDown + " down, pass it around!”);
potionsOnTheWall -= numToTakeDown;
this.say(potionsOnTheWall + " potions of health on the wall.");
}
JavaScript has compound assignment operators (+=, -=, *=, /=) as well as increment/decrement operators (++, --). Python has compound assignment operators but no increment/decrement operators.
local potionsOnTheWall = 10
local numToTakeDown = 1
local numero = potionsOnTheWall - numToTakeDown
loop
self.say (potionsOnTheWall + “! pociones de salud en la pared”)
–Canta la siguiente línea:
self.say (potionsOnTheWall + “! pociones de helth”)
–Canta la siguiente línea:
self.say ( “Take” + numToTakeDown + “hacia abajo, pasarlo alrededor!”)
potionsOnTheWall - = numToTakeDown
–anta la última línea:
self.say (potionsOnTheWall + “pociones de salud en la pared.”)
end
potionsOnTheWall = 10
numToTakeDown = 1
while True:
hero.say(potionsOnTheWall + " potions of health on the wall!")
# Sing the next line:
hero.say(potionsOnTheWall + " potions of health!")
# Sing the next line:
hero.say(potionsOnTheWall + " Take Y down, pass it around!")
potionsOnTheWall -= numToTakeDown
# Sing the last line:
hero.say(potionsOnTheWall + " X-Y potions of health on the wall")
potionsOnTheWall = 10
numToTakeDown = 1
while True:
hero.say(potionsOnTheWall + " potions of health on the wall!")
# Sing the next line:
hero.say(potionsOnTheWall + “potions of health”)
# Sing the next line:
hero.say(“take” + numToTakeDown + "down, pass it around!"
potionsOnTheWall -= numToTakeDown
# Sing the last line:
hero.say(potionsOnTheWall + “potions of health on the wall.”
potionsOnTheWall = 10
numToTakeDown = 1
while True:
hero.say(potionsOnTheWall + " potions of health on the wall!")
# Sing the next line:
hero.say(potionsOnTheWall + " potion of health!")
# Sing the next line:
hero.say("Take " + numToTakeDown + " down, pass it around!")
potionsOnTheWall -= numToTakeDown
# Sing the last line:
hero.say(potionsOnTheWall + " potions of health on the wall.")
Please paste ALL of your code inside the triple back tick marks.
``` <— Triple back tick marks.
Paste ALL of your code in here.
``` <— Triple back tick marks.
There are many people here willing and able to help. If you use the </> button correctly, then ALL of your code should look like this:
while True:
enemy = hero.findNearestEnemy()
if enemy:
hero.attack(enemy)
else:
hero.say("My code is formatted properly")
If ALL of your code isn’t formatted like the code above, then you’re doing it wrong and we can’t see the structure of the code to troubleshoot whether or not that is the issue. Use the </> button and help us help you. This works when sending a private message as well.