fork download
  1. from itertools import product
  2. solutions = [(j, b) for j, b in product(range(0, 5+1), range(0, 8+1)) if j < b]
  3. formatString = "{0:^6}|{1:^12}|{2:^12}"
  4. print(formatString.format("nr", "jabłek", "brzoskwiń"))
  5. for i, (j, b) in enumerate(solutions, 1):
  6. print(formatString.format(i, j, b))
Success #stdin #stdout 0.02s 27712KB
stdin
Standard input is empty
stdout
  nr  |   jabłek   | brzoskwiń  
  1   |     0      |     1      
  2   |     0      |     2      
  3   |     0      |     3      
  4   |     0      |     4      
  5   |     0      |     5      
  6   |     0      |     6      
  7   |     0      |     7      
  8   |     0      |     8      
  9   |     1      |     2      
  10  |     1      |     3      
  11  |     1      |     4      
  12  |     1      |     5      
  13  |     1      |     6      
  14  |     1      |     7      
  15  |     1      |     8      
  16  |     2      |     3      
  17  |     2      |     4      
  18  |     2      |     5      
  19  |     2      |     6      
  20  |     2      |     7      
  21  |     2      |     8      
  22  |     3      |     4      
  23  |     3      |     5      
  24  |     3      |     6      
  25  |     3      |     7      
  26  |     3      |     8      
  27  |     4      |     5      
  28  |     4      |     6      
  29  |     4      |     7      
  30  |     4      |     8      
  31  |     5      |     6      
  32  |     5      |     7      
  33  |     5      |     8