回答編集履歴
2
修正
test
CHANGED
@@ -67,3 +67,17 @@
|
|
67
67
|
print("se" in (set(X) & set(Y)))
|
68
68
|
|
69
69
|
```
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
n-gram を作る関数は内包記法で書くこともできます。
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
```python
|
78
|
+
|
79
|
+
def get_n_gram(n, word):
|
80
|
+
|
81
|
+
return [word[i : i + n] for i in range(len(word) - n + 1)]
|
82
|
+
|
83
|
+
```
|
1
修正
test
CHANGED
@@ -4,7 +4,29 @@
|
|
4
4
|
|
5
5
|
|
6
6
|
|
7
|
+
例:
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
```python
|
12
|
+
|
13
|
+
s = "Apple"
|
14
|
+
|
15
|
+
for char in s:
|
16
|
+
|
17
|
+
print(char, end=" ")
|
18
|
+
|
19
|
+
# A p p l e
|
20
|
+
|
7
21
|
```
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
## 修正後のコード
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
```python
|
8
30
|
|
9
31
|
def get_n_gram(n, words):
|
10
32
|
|