class School:
def \_\_init\_\_(self):
self.student ={}
self.history = []
def student\_exists(self, name):
for grade in self.student:
return name in self.student[grade]
return False # dopo aver controllato tutte le liste, se non l´ho trovato non esite
def add\_student(self, name, grade):
if self.student\_exists(name):
self.history.append(False)
return # alternativa di break, ma salta fuori dalla funzione
if grade not in self.student:
self.student[grade] = []
self.student[grade].append(name)
self.history.append(True)
def roster(self):
ls\_st=[]
for grade in sorted(self.student.keys()):
ls\_st += sorted(self.student[grade])
return ls\_st
def grade(self, grade\_number):
if grade\_number in self.student:
return sorted(self.student[grade\_number])
else:
return []
def added(self):
return self.history
View or trade
BEER
.Hey @drago18121996, here is a little bit of
BEER
from @isnochys for you. Enjoy it!Did you know that <a href='https://dcity.io/cityyou can use BEER at dCity game to buy cards to rule the world.
Thank you for your witness vote!
Have a !BEER on me!
To Opt-Out of my witness beer program just comment STOP below