Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

First dungeon: "Known Enemy" level, need help with := (Python)

I’m not able to declare a variable with walrus operator.

This is what I write, from the hints menu;

enemy1 := “Kratt”

Which immediately gives me the following error;

If you want to call enemy1 as a function, you need ( )'s.`

This won’t run. I don’t understand.

you have a semicolon in front of your equals sign. Delete that and you should be fine :slight_smile: Welcom to the discourse! :partying_face:

Hello @Alex_George, and welcome to codecombat discourse! This is a cozy forum where you can share ideas, share fan art, get assistance for code, etc! Before you proceed, we hope that you review this topic, which shows all essentials of this board! Thanks!

@Alex_George welcome to CodeCombat Discourse! As @JoPro_8000 said, you don’t need the :, delete that. Aside from that, you don’t have a problem with that line.

Well yeah but it was copy-pasted from the hints menu. I don’t understand why the walrus operator doesn’t work.

Can you show me how to declare this variable with walrus?

It was part of the hints menu. I copy-pasted from the official game hints menu. Can you show me how the walrus operator should be used in this case?

What do you mean by the walrus operator? Are you sure the hints were in Python?


Screenshot 2021-04-02 at 12.19.40

This is probably a typo.

Yes, that’s the level hint screen and it doesn’t work!!

Why do you want to use

?

Because I’d like to learn walrus to see how it works. Learning process.

You’re not supposed to put :

I’m just following the hints. Is this a bad hint?

This picture Screenshot 2021-04-02 at 12.19.40 has what you need to complete the level. For walrus operator you might need to do Screenshot 2021-04-02 at 12.32.45 .

Yes.

20 charactersss

That doesn’t work either.

It’s not my computer. I’m on Windows with latest version of Firefox and it does the same thing, as well as on my Chromebook Go.