Nov-23-2022, 08:05 PM
Hi! How can I add in both list (in first fname and in second the person object) every time when I creat a Person?
Secondary how can I add in a list online students?
Thanks!
Secondary how can I add in a list online students?
Thanks!
class Person:
name_persons = []
object_persons = []
def __init__(self, fname, lname, cnp, age):
self.fname = fname
self.lname = lname
self.cnp = cnp
self.age = age
@staticmethod
def add_person(self, fname):
self.name_persons.append(fname)
def gender(self):
if str(self.cnp)[0] == 1:
return "m"
return 'f'
class Student(Person):
def __init__(self, nume, prenume, cnp, varsta, medie):
super().__init__(nume, prenume, cnp, varsta)
self.medie = medi
