I have the following python code:
class university:
q_university = []
def __init__(self, name, ranking, country):
self.name = name
self.ranking = ranking
self.country = country
@staticmethod
def create_object(name, ranking, country):
university_object = university(name,ranking,country)
q_university.append(university_object)
return university_object
I would like to create the q_university declared static, so I can append the university object to it. However, when I declare it outside the function I am not able to access it within the function.
Any suggestions?