Is there any way to reflect the value of n in cost function globally . so that the value of n in getLeastCost function with be changed instead of n = 0
class TheShuttles:
def getLeastCost(self,baseCost,seatCost,cnt):
n = 0
def cost(x):
n = sum( m / x + (m % x != 0 ) for m in cnt)
return n * (baseCost + x * seatCost)
print n { prints 0 }
return min( cost(x) for x in range(1,101) )