回答編集履歴
1
コード変更
test
CHANGED
@@ -8,27 +8,19 @@
|
|
8
8
|
|
9
9
|
```
|
10
10
|
|
11
|
-
|
11
|
+
def replace(word_list, s):
|
12
12
|
|
13
|
-
|
13
|
+
i = 0
|
14
14
|
|
15
|
-
|
15
|
+
s2 = ''.join(s)
|
16
16
|
|
17
|
-
word_list
|
17
|
+
while i < len(word_list):
|
18
18
|
|
19
|
-
l
|
19
|
+
if word_list[i] == s[0] and word_list[i:i+len(s)] == s:
|
20
20
|
|
21
|
-
i
|
21
|
+
word_list[i:i+len(s)] = [s2]
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
print(word_list)
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
23
|
+
i += 1
|
30
|
-
|
31
|
-
['東京', '人気', 'お店', 'メニュー', '焼肉定食', '300円', '期間', '限定', '焼肉', '単品', '250円', '焼肉', 'サラダ', '定食', '焼肉', '増量']
|
32
24
|
|
33
25
|
```
|
34
26
|
|