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

[SOLVED] Triage [Python]

#Triage the wounded soldiers
doctor = hero.findByType("paladin")[0]
mage = hero.findByType("pixie")[0]
helper = hero.findByType("peasant")[0]
soldiers = hero.findByType("soldier")

# Initialize patient arrays.
doctorPatients = []
magePatients = []
helperPatients = []

# Iterate all the soldiers:
for soldier in soldiers:
    # If soldier is slowed:
    if soldier.maxSpeed < 6:
        # Add them to the 'mage's array of patients.
    # Else if is less than half of maxHealth:
    elif < soldier.maxHealth / 2:
        # Add them to the 'doctor's array of patients.
    # Else:
        # Add soldier to the 'helper's array of patients.

# Now assign the patient lists to the appropriate person.
mage["patients"] = magePatients
doctor["patients"] = doctorPatients
helper["patients"] = helperPatients

Please help I don’t know what to do

Hi @Destroyer5023 and welcome to the forum! :partying_face:

What do you mean? Does it give you any errors?

Your code is like my working one, so try resummiting and it should work fine. Let me know if you encounter any more problems, ok?

oh thanks i beat the level

1 Like

No problem! Glad I could help! :smiley:

1 Like

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.