lundi 18 juillet 2016

Python Find minimum object using special comparator


So I got my question answered on how to find the minimum value, but what if I want the minimum object? Can we similarly simplify this code? min = 9999 minChild = None for child in currentRoot.children: if child.score < min: min = child.score minChild = child recurseWriteBook(child, depth+1)

Aucun commentaire:

Enregistrer un commentaire