From d367600acf738fc49263f83e6f26102c81a47bdb Mon Sep 17 00:00:00 2001 From: majestic-owl448 <26656284+majestic-owl448@users.noreply.github.com> Date: Wed, 13 May 2026 16:26:03 +0200 Subject: [PATCH] fix: salary tracker step 32 misleading hint (#67324) --- .../68ca758f8160b11757f877ae.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/curriculum/challenges/english/blocks/workshop-salary-tracker/68ca758f8160b11757f877ae.md b/curriculum/challenges/english/blocks/workshop-salary-tracker/68ca758f8160b11757f877ae.md index afb939646f3..b3e0dd94328 100644 --- a/curriculum/challenges/english/blocks/workshop-salary-tracker/68ca758f8160b11757f877ae.md +++ b/curriculum/challenges/english/blocks/workshop-salary-tracker/68ca758f8160b11757f877ae.md @@ -22,7 +22,16 @@ You should have a fourth `if` statement inside your `level` setter. Your `if` statement should use `hasattr(self, '_level')` to check if `_level` exists before comparing. ```js -({ test: () => assert(runPython(`_Node(_code).find_class("Employee").find_functions("level")[1].find_ifs()[3].find_conditions()[0].is_equivalent("hasattr(self, '_level') and Employee._base_salaries[new_level] < Employee._base_salaries[self.level]")`)) }) +({ test: () => assert(runPython(`"hasattr(self, '_level')" in str(_Node(_code).find_class("Employee").find_functions("level")[1].find_ifs()[3].find_conditions()[0])`)) }) +``` + +Your `if` statement should compare `Employee._base_salaries[new_level]` against `Employee._base_salaries[self.level]` to check if the new level has a lower base salary. + +```js +({ test: () => assert(runPython(` +cond = _Node(_code).find_class("Employee").find_functions("level")[1].find_ifs()[3].find_conditions()[0] +cond.is_equivalent("hasattr(self, '_level') and Employee._base_salaries[new_level] < Employee._base_salaries[self.level]") or cond.is_equivalent("hasattr(self, '_level') and Employee._base_salaries[self.level] > Employee._base_salaries[new_level]") +`)) }) ``` When `new_level` is lower than `self.level`, you should raise a `ValueError` with the message `Cannot change to lower level.`