ݨDδ+I%»
在线尝试!
说明
# Implicit input n = 3 [3]
Ý # Push range(0,3) [[0,1,2,3]]
¨ # Pop last element [[0,1,2]]
D # Duplicate [[0,1,2],[0,1,2]]
δ # Apply next operation double vectorized
+ # Vectorized addition [[[0,1,2],[1,2,3],[2,3,4]]]
I # Push input [[[0,1,2],[1,2,3],[2,3,4]],3]
% # Elementwise modulo 3 [[[0,1,2],[1,2,0],[2,0,1]]]
» # " ".join(x) followed by newline ["0 1 2\n1 2 0\n2 0 1\n"]
for every x in list
上一个答案:10个字节
ݨDvDðý,À}
在线尝试!
我第一次尝试打高尔夫球是05AB1E。
先前答案的解释
# Implicit input n = 3 [3]
Ý # Push range(0,3) [[0,1,2,3]]
¨ # Pop last element. [[0,1,2]]
D # Duplicate [[0,1,2],[0,1,2]]
v } # Pop list and loop through elements [[0,1,2]]
D # Duplicate [[0,1,2],[0,1,2]]
ð # Push space char [[0,1,2],[0,1,2], " "]
ý # Pop list a and push string a.join(" ") [[0,1,2],"0 1 2"]
, # Print string with trailing newline [[0,1,2]] Print: "0 1 2"
À # Rotate list [[1,2,0]]