回答編集履歴
1
内容修正
test
CHANGED
@@ -11,3 +11,25 @@
|
|
11
11
|
result_dict[name] = choice_dict.copy()
|
12
12
|
|
13
13
|
```
|
14
|
+
|
15
|
+
もしくは、`choice_dict`の定義位置を変更する。こっちのほうが自然かな。
|
16
|
+
|
17
|
+
```python
|
18
|
+
|
19
|
+
result_dict = {}
|
20
|
+
|
21
|
+
for name in ["鈴木","佐藤","高橋"]:
|
22
|
+
|
23
|
+
choice_dict = {}
|
24
|
+
|
25
|
+
for i in range(3):
|
26
|
+
|
27
|
+
choice_dict[i] = random.choice(["グー","チョキ","パー"])
|
28
|
+
|
29
|
+
# for文を抜ける前
|
30
|
+
|
31
|
+
print(name,choice_dict)
|
32
|
+
|
33
|
+
result_dict[name] = choice_dict
|
34
|
+
|
35
|
+
```
|