habe eine liste mit objekten, die alle ein gewicht haben.
kann ich mit der min built-in funktion das objekt herausfinden, das das kleinste gewicht hat? kriegs nicht auf die reihe...also so à la
Code: Alles auswählen
a=[Objekt(),Objekt(),Objekt()]
print min(a...?)
thx for helpmin(iterable[, args...][, key])¶
With a single argument iterable, return the smallest item of a non-empty iterable (such as a string, tuple or list). With more than one argument, return the smallest of the arguments.
The optional key argument specifies a one-argument ordering function like that used for list.sort(). The key argument, if supplied, must be in keyword form (for example, min(a,b,c,key=func)).