# Volcano Fighters - python - don't know how to solve it

``````# Complete the paladin rectangle to protect the village.

# This function finds the left-most unit.
def findMostLeft(units):
if len(units) == 0:
return None
mostLeft = units[0]
for unit in units:
if unit.pos.x < mostLeft.pos.x:
mostLeft = unit
return mostLeft

# This function finds the bottom-most unit:
def findMostBottom(units):
if len(units) == 0:
return None
mostBottom = units[0]
for unit in units:
if unit.pos.y < mostBottom.pos.y:
mostBottom = unit
return mostBottom

# Find the top left paladin with findMostLeft function:
def findTopLeft(units):
if len(units) == 0:
return None
mostTop = units[0]
units = findMostLeft(units)
for unit in units:
if unit.pos.y > mostTop.pos.y:
mostTop = unit
topLeft = mostTop

# Find the bottom right paladin with findMostBottom function:
def findBottomRight(units):
if len(units) == 0:
return None
mostRight = units[0]
findMostBottom(units)
for unit in units:
if unit.pos.x > mostRight.pos.x:
mostRight = unit
bottomRight = mostRight
return bottomRight

# Use X coordinate from the top left paladin:
# and Y coordinate from the bottom right paladin: