Untitled

 avatar
unknown
python
3 years ago
610 B
4
Indexable
class StudentService:

    def __init__(self, imie, nazwisko):
        self.imie = imie
        self.nazwisko = nazwisko
        self.lista_studentow = []

    def __str__(self):
        return f"{self.imie} {self.nazwisko}"

    def wyswietl_liste_studentow(self):
        print(self.lista_studentow)

    def dodaj_studenta(self):
        self.lista_studentow.append(self)
        return self.lista_studentow

    def usun_studenta(self, index):
        self.lista_studentow.pop(index)
        return self.lista_studentow

student1 = StudentService('Anna', 'Nowak')
print(student1)

student1.dodaj_studenta()
Editor is loading...