# Follow me on youtube channel Phy Tu
# Help with programming on Python, school math, physics
# https://www.youtube.com/channel/UCP5ycahCEZ24qmRRgNnko5Q
# You can't reach your friends to defend them!
# Tell them to go home where the archer can help.
while True:
weakestFriend = None
leastHealth = 9999
friendIndex = 0
friends=hero.findFriends()
# Find which friend has the lowest health.
for friend in friends:
# Tell the weakest friends to go home first.
if leastHealth>friend.health and friend.type!="archer":
weakestFriend=friend
leastHealth=friend.health
if weakestFriend:
hero.say('Hey ' + weakestFriend.id + ', go home!')