class Nabolag: def __init__(self): self._hus = [] def legg_til_hus(self, hus): self._hus.append(hus) def antall_bad(self): antall = 0 for hus in self._hus: for rom in hus.hent_romliste(): if rom.hent_navn() == "Bad": antall += 1 return antall def __str__(self): streng = "" i = 1 for hus in self._hus: streng += "\n\nHus " + str(i) + ": \n" + str(hus) i += 1 return streng