回答編集履歴
1
追記
test
CHANGED
@@ -1 +1,29 @@
|
|
1
1
|
ループ処理と辞書を使ってはどうでしょうか?
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
【追記】
|
6
|
+
|
7
|
+
簡単な例です。
|
8
|
+
|
9
|
+
```Python
|
10
|
+
|
11
|
+
d = {}
|
12
|
+
|
13
|
+
answer1 = input()
|
14
|
+
|
15
|
+
>>>a
|
16
|
+
|
17
|
+
if answer1 in d:
|
18
|
+
|
19
|
+
d[answer1] = d[answer1] + 1
|
20
|
+
|
21
|
+
else:
|
22
|
+
|
23
|
+
d[answer1] = 1
|
24
|
+
|
25
|
+
print(d)
|
26
|
+
|
27
|
+
#{'a': 1}
|
28
|
+
|
29
|
+
```
|