from bok import Bok from bibliotek import Bibliotek from kunde import Kunde bok = Bok("Snø", "Jo Nesbø") bok1 = Bok("Den Gamle Mannen Og Havet", "Ernest Hemingway") bok2 = Bok("Harry Potter", "J.K.Rowling") bok3 = Bok("Bibelen", "Gideon") bok4 = Bok("Snø", "Jo Nesbø") kunde = Kunde() deichmann = Bibliotek("Deichmann") deichmann.leggTilBok(bok) deichmann.leggTilBok(bok1) deichmann.leggTilBok(bok2) deichmann.leggTilBok(bok3) print("ANTALL BØKER DEICHMANN: ", deichmann.antallBoker()) print("ANTALL BØKER KUNDE: ", kunde.antallBoker()) deichmann.laanUt("Snø", "Jo Nesbø", kunde) deichmann.laanUt("Harry Potter", "J.K.Rowling", kunde) print("ANTALL BØKER DEICHMANN: ", deichmann.antallBoker()) print("ANTALL BØKER KUNDE: ", kunde.antallBoker()) kunde.leverBoker(deichmann) print("ANTALL BØKER DEICHMANN: ", deichmann.antallBoker()) print("ANTALL BØKER KUNDE: ", kunde.antallBoker()) #TEST AV __eq__ metode i klassen Bok: #print(bok1) #print(bok == bok4) # Returnerer True fordi bøkenes titler og forfattere er de samme #print(bok is bok4) # Returnerer False fordi is "overstyrer" __eq__ metoden.