Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class klasa_1():
- def __init__(self, nr1, nr2):
- self.nr1 = nr1
- self.nr2 = nr2
- def __str__(self):
- info = f'{self.nr1} {self.nr2}'
- return info
- class klasa_2():
- lista =[]
- def __init__(self, nr1, nr2):
- self.nr1 = nr1
- self.nr2 = nr2
- def dodaj(self):
- nowy = klasa_1(self.nr1, self.nr2)
- self.lista.append(nowy)
- def wyswietlaj(self):
- print(self.lista)
- print(self.lista[0])
- for i in self.lista:
- if i.nr1 == 3:
- print(i)
- else:
- print("Pusto")
- print(klasa_1(3, 5))
- o = klasa_2(3, 5)
- o.dodaj()
- o.wyswietlaj()
Advertisement
Add Comment
Please, Sign In to add comment