Return None instead of empty list

This commit is contained in:
Em (Ethan) Ruszanowski 2024-02-16 17:07:28 -05:00
parent 9da4481750
commit 1a95687e59
Signed by: em
GPG key ID: 1A6725F1A81D6D50

9
app.py
View file

@ -32,9 +32,16 @@ def find_spawnlist(remaining_power: int, creatures: list[Creature]) -> list[str]
:param remaining_power: The remaining power in the current location.
:return: A list of all creatures that may still spawn.
"""
return sorted(
if remaining_power == 0:
return None
spawnable = sorted(
[creature.name for creature in creatures if creature.power <= remaining_power]
)
if spawnable != []:
return spawnable
else:
return None
def main():