Untitled
unknown
python
3 years ago
754 B
5
Indexable
import uuid
class Student():
def __init__(self, imie, nazwisko):
self.uuid = uuid.uuid4()
self.imie = imie
self.nazwisko = nazwisko
self.lista_ocen = []
def __str__(self):
return f"{self.imie} {self.nazwisko}"
def wyswietl_liste_ocen(self):
print(self.lista_ocen)
def dodaj_nowa_ocene(self, nowa_ocena):
lista_dopuszczalnych_ocen = [2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0]
if nowa_ocena in lista_dopuszczalnych_ocen:
self.lista_ocen.append(nowa_ocena)
else:
raise ValueError("Nieprawidłowy format oceny!")
def edytuj_ocene(self):
pass
def usun_ocene(self):
pass
student1 = Student("Anna", "Nowak")
print(student1)Editor is loading...