By Any Other Name Problem

Thanks. We’ll check and fix it ASAP.

It didn’t work, but that should be obsolete soon. Thanks anyway!

The game was looking at variables that are assigned findNearestEnemy(), but not findNearest(findEnemies()), so your code wasn’t getting checked correctly. This should now be fixed.

1 Like

It works! Thank you!

can not pass

my code

gemDude = hero.findNearestEnemy()
hero.attack(gemDude)
gemDude1 = hero.findNearestEnemy()
hero.attack(gemDude1)

is it mistake ?

  1. You have not written any code to collect gems once the ogres have been killed.
  2. I don’t know what sword you’re using but you may have to attack each ogre twice to kill it.

I don’t know why. But today it’s code working. Maybe it was mistake on server.

It still does not work :frowning: … How can I solve the problem?

Care to post your code? Just paste it into the reply box, highlight it, and click the </> button to format it correctly.

Hello, I’m trying to pass this level, but I cannot get passed the gates to gather the gems, level name “By any other name” programming language: Python

# Change the names of variables to make gems appear!
# Change the name of variable "enemy1" to "gemDude1".
enemy1 = gemDude1
gemDude1 = hero.findNearestEnemy()
hero.attack(gemDude1)
hero.attack(gemDude1)

# Change the name of variable "enemy2" to "gemDude2".
enemy2 = gemDude2
gemDude2 = hero.findNearestEnemy()
hero.attack(gemDude2)
hero.attack(gemDude2)

# Collect the gems after changing the variables.
hero.moveUp()
hero.moveRight()
hero.moveRight()

This level is checking to see if you renamed the enemy# variable. To pass the level, you can’t have any enemy# variables in your code. The two lines of code that have this prevent the level from passing and don’t help your code. Remove them and you should be good.

Hi,

I am stuck on this too. Can you help please?

The code above seems to have changed the variables and I cannot see which are the two lines of code which retain the enemy variables.

The enemies are labelled as gemDude 1 and gemDude but no new gems appear.

Many thanks!Capture

Thank you for the quick reply, I will try to apply this at more earliest convenience to finally pass this level.

Thank you for your assistance,

Adrian Rios

The main idea on this level is that you can use any variable name and assign a value to it.

variable = value

To pass this level use the different variable names provided and not enemy1 and enemy2. New gems don’t appear, the fence disappears so you can get the two gems you see. To see the value of the variable you can command your hero to say the variable. The name of gemDude1 is Kog, the nearest enemy. Later you will be able to click on the enemies and it will show you their name and some attributes. This lets you verify if your code is running as expected.

gemDude1 = hero.findNearestEnemy()
hero.say(gemDude1)

say

If anyone is wondering why the gem is behind a fence, check that you’ve done as instructed… starting ALL THE WAY AT THE TOP (don’t ask how long it took me to figure this out…).

Hi, please don’t necropost :) It’s been 3 years

1 Like

I saidDON"T ASK HOW LONG IT TOOK ME!

(noted… sorry).

1 Like