def produce(self, data): resources_n = len(data['resources']) for i in range(0, resources_n): production = self.productivity[i] * self.population previous_supply = self.commodity_stocks[i] self.commodity_stocks[i] += production self.prices[i] = economics.find_price(previous_supply, self.commodity_stocks[i], self.prices[i], data['resources'][i].base_demand, data['resources'][i].price_elasticity)