from traktor import Traktor class Bonde: def __init__(self, traktor1, traktor2, traktor3): self._p?_jordet = [traktor1, traktor2, traktor3] self._i_l?ven = [] def kj?r_inn(self): minst_indeks = 0 minst_trekkvekt = self._p?_jordet[0].hent_trekkvekt() for i in range(len(self._p?_jordet)): if self._p?_jordet[i].hent_trekkvekt() < minst_trekkvekt: minst_trekkvekt = self._p?_jordet[i].hent_trekkvekt() minst_indeks = i self._i_l?ven.append(self._p?_jordet[minst_indeks]) self._p?_jordet.pop(minst_indeks) def hent_jordet(self): return self._p?_jordet def hent_l?ven(self): return self._i_l?ven bonde = Bonde(Traktor(1000), Traktor(1500), Traktor(1200)) print(bonde.hent_jordet()) print(bonde.hent_l?ven()) bonde.kj?r_inn() print(bonde.hent_jordet()) print(bonde.hent_l?ven()) bonde.kj?r_inn() print(bonde.hent_jordet()) print(bonde.hent_l?ven()) bonde.kj?r_inn() print(bonde.hent_jordet()) print(bonde.hent_l?ven())