Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Uczen:
- def __init__(self, name):
- self.name = name
- self.oceny = []
- def dodaj_ocene(self, ocena):
- self.oceny.append(ocena)
- def policz_srednia(self):
- suma = 0
- for ocena in self.oceny:
- suma += ocena
- return suma/len(self.oceny)
- from uczen import Uczen
- uczen = Uczen("Adrian")
- print(uczen.name)
- uczen.dodaj_ocene(5)
- uczen.dodaj_ocene(1)
- uczen.dodaj_ocene(3)
- print(uczen.oceny)
- print(uczen.policz_srednia())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement