回答編集履歴
1
テキスト追加
test
CHANGED
@@ -27,3 +27,43 @@
|
|
27
27
|
+ x[i] = data[j:k] if k < 0 else data[j:]
|
28
28
|
|
29
29
|
```
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
## 追記
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
以下は `data`を使わないで、目的の `x` を作るコードです。
|
38
|
+
|
39
|
+
```python
|
40
|
+
|
41
|
+
import numpy as np
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
num = 4
|
46
|
+
|
47
|
+
start = 5
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
x = np.zeros((num, num))
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
for i in range(num):
|
56
|
+
|
57
|
+
j = start + i
|
58
|
+
|
59
|
+
k = j + num
|
60
|
+
|
61
|
+
x[i] = range(j, k)
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
print(x)
|
68
|
+
|
69
|
+
```
|