looping through possible combinations of McNuggets packs of 6, 9 and 20

Baba raoulbia at gmail.com
Wed Aug 11 22:14:35 CEST 2010

level: beginner

exercise: given that packs of McNuggets can only be bought in 6, 9 or
20 packs, write an exhaustive search to find the largest number of
McNuggets that cannot be bought in exact quantity.

exercise source:

please help me write this code

i believe it's something along the lines of this:

for n in range (0,10):
 for a in range (0,10):
  for b in range (0,10):
   for c in range (0,10):
    if sol!=n:
    if c==6:
     print sol

More information about the Python-list mailing list