回答編集履歴

3

文法修正

2018/12/09 01:45

投稿

Kommm
Kommm

スコア20

test CHANGED
@@ -24,10 +24,8 @@
24
24
 
25
25
  # 通常処理に続く
26
26
 
27
+ print(keyword)
27
28
 
28
-
29
- print(sortlist)
30
-
31
- # "みかん りんご"はcontinue発動して存在しない
29
+ # "みかん りんご"はcontinue発動して存在しない
32
30
 
33
31
  ```

2

ミス修正

2018/12/09 01:45

投稿

Kommm
Kommm

スコア20

test CHANGED
@@ -18,7 +18,7 @@
18
18
 
19
19
  if not test in sortlist:
20
20
 
21
- sortlist.append(list_no2.split(" ").sort)
21
+ sortlist.append(test)
22
22
 
23
23
  else: continue
24
24
 

1

for文をきちんといれる

2018/12/09 01:42

投稿

Kommm
Kommm

スコア20

test CHANGED
@@ -6,34 +6,28 @@
6
6
 
7
7
  ```python
8
8
 
9
+ sortlist = []
10
+
9
- sortlist = [["不動産","投資"], ["投資信託 低利"]]
11
+ extract_keywords = ["りんご みかん", "みかん りんご", "不動産 賃貸"]
10
12
 
11
13
 
12
14
 
13
- list_no2 = "りんご みかん"
15
+ for keyword in extract_keywords:
14
16
 
15
- test = list_no2.split(" ").sort
17
+ test = keyword.split(" ").sort
16
18
 
17
- if not test in sortlist:
19
+ if not test in sortlist:
18
20
 
19
- sortlist.append(list_no2.split(" ").sort)
21
+ sortlist.append(list_no2.split(" ").sort)
20
22
 
21
- else: continue
23
+ else: continue
22
24
 
23
- # 通常処理
25
+ # 通常処理に続く
24
26
 
25
27
 
26
28
 
27
- list_no3 = "みかん りんご"
29
+ print(sortlist)
28
30
 
29
- test = list_no3.split(" ").sort
31
+ # "みかん りんご"はcontinue発動して存在しない
30
-
31
- if not test in sortlist:
32
-
33
- sortlist.append(list_no2.split(" ").sort)
34
-
35
- else: continue
36
-
37
- # continue発動
38
32
 
39
33
  ```