from bok import Bok class Bokhylle: def __init__(self, maks_antall): self._maks_antall = maks_antall self._b?ker = [] def er_ledig_plass(self): if self._maks_antall > len(self._b?ker): return True return False def legg_til_bok(self, bok): assert type(bok) == Bok if not self.er_ledig_plass(): return False self._b?ker.append(bok) return True def finn_bok(self, tittel, ?r): for bok in self._b?ker: if bok.hent_tittel() == tittel and bok.hent_?r() == ?r: return bok return False def __str__(self): streng = "" for bok in self._b?ker: streng += str(bok) streng += "\n" return streng