In a previous post "Struggling with classes" I made a program that analyzed sales for a number of casinos. I have now expanded the program so that I can solve for all possible solutions of the form ax+by+cz=N
where a,b and c are my given entry fees for adults, child and elderly. N is my total revenues for each casino. I want to find all x,y,z combinations (non negative) for a given N.
This is what I got so far, but I'm kinda stuck because this only gives me the 0,0,0-solution
Any ideas how I should proceed?
- Code: Select all
print(self.name,':',A,'*X +',C,'*Y +',E,'*Z =',self.revenueTot)
#gcd = greatest common divider
for a in range(0,GCD):
for b in range(0,GCD):
for c in range(0,GCD):