fork(1) download
  1. def f(n):r=range(n+2);print([x for x in[[i/-~n,j/-~n,k/-~n]for i in r for j in r for k in r]if sum(x)==1])
  2.  
  3. for n in range(4):
  4. print('Input: '+str(n))
  5. print('Output: ',end='')
  6. f(n)
  7. print()
Success #stdin #stdout 0.02s 9992KB
stdin
Standard input is empty
stdout
Input: 0
Output: [[0.0, 0.0, 1.0], [0.0, 1.0, 0.0], [1.0, 0.0, 0.0]]

Input: 1
Output: [[0.0, 0.0, 1.0], [0.0, 0.5, 0.5], [0.0, 1.0, 0.0], [0.5, 0.0, 0.5], [0.5, 0.5, 0.0], [1.0, 0.0, 0.0]]

Input: 2
Output: [[0.0, 0.0, 1.0], [0.0, 0.3333333333333333, 0.6666666666666666], [0.0, 0.6666666666666666, 0.3333333333333333], [0.0, 1.0, 0.0], [0.3333333333333333, 0.0, 0.6666666666666666], [0.3333333333333333, 0.3333333333333333, 0.3333333333333333], [0.3333333333333333, 0.6666666666666666, 0.0], [0.6666666666666666, 0.0, 0.3333333333333333], [0.6666666666666666, 0.3333333333333333, 0.0], [1.0, 0.0, 0.0]]

Input: 3
Output: [[0.0, 0.0, 1.0], [0.0, 0.25, 0.75], [0.0, 0.5, 0.5], [0.0, 0.75, 0.25], [0.0, 1.0, 0.0], [0.25, 0.0, 0.75], [0.25, 0.25, 0.5], [0.25, 0.5, 0.25], [0.25, 0.75, 0.0], [0.5, 0.0, 0.5], [0.5, 0.25, 0.25], [0.5, 0.5, 0.0], [0.75, 0.0, 0.25], [0.75, 0.25, 0.0], [1.0, 0.0, 0.0]]