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

Kithguard brawl, python, "unexpected token" from if flag: (SOLVED)


In kithguard brawl, I want to use
flag = self.findFlag() if flag:
like I learned in later worlds (new to python).

However, if flag: throws an “unexpected token” exception and the hero keeps taking it.


Give us the entirety of your code. There may be something wrong somewhere else that causes this error.


I was looking at the code before checking the topic, copied it into my usual editor and immediately saw i forgot to close a bracket in a definition above if flag:.
Such a noobish error, but that’s what you get when you’re using ease-of-life editors like I do.

Find My Line.


for me it will say add a : to the end of the code and when i add one it still says it