Skip to content

L14.P2 Reducing damage at higher levels: check rejects correct solutions that don't reassign amount #1388

Closed

Description

@madison-nicole

What happened?
I solved the problem with a solution that worked and accomplished everything intended but did not pass the tests. Doing the multiplication by 0.5 at the subtraction rather than assigning the result back to amount fails despite a 10-damage attack still being reduced to 5 above level 2, with full damage below level 3. The second check, "Damage Amount Is Correct Value", passed.

Where were you in the app?
L14.P2 Reducing damage at higher levels

What did you expect to happen?
The test should accept the other solutions that work as intended instead of restricting to certain syntax.

Your code

var level = 3
var health = 100
var max_health = 100

func take_damage(amount):
	if level > 2:
		health -= amount * 0.5
	else:
		health -= amount

	if health < 0:
		health = 0

Optional: screenshot or other details
Image

Activity

  1. madison-nicole commented on Sep 8, 2026

    @madison-nicole
    ContributorAuthor

    I'm opening a PR for this. The restriction is in test_multiplication_is_used_to_reduce_damage_amount in TestReducingDamage.gd, which requires an assignment targeting the function's first parameter, so I'll widen it to accept the other correct forms.

  2. added theissue type on Sep 28, 2026
  3. added a commit that references this issue on Oct 10, 2026
    a2505e6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working as intended

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions