回答編集履歴

2

変数名変更

2020/02/06 06:05

投稿

shiracamus
shiracamus

スコア5406

test CHANGED
@@ -12,23 +12,23 @@
12
12
 
13
13
  list0 = [0] * 3
14
14
 
15
- for i in range(3):
15
+ for column in range(3):
16
16
 
17
- if list2[i] <= list1[i] >= list3[i]:
17
+ if list2[column] <= list1[column] >= list3[column]:
18
18
 
19
- list0[i] = 1
19
+ list0[column] = 1
20
20
 
21
- for i in range(3):
21
+ for column in range(3):
22
22
 
23
- if list1[i] <= list2[i] >= list3[i]:
23
+ if list1[column] <= list2[column] >= list3[column]:
24
24
 
25
- list0[i] = 2
25
+ list0[column] = 2
26
26
 
27
- for i in range(3):
27
+ for column in range(3):
28
28
 
29
- if list1[i] <= list3[i] >= list2[i]:
29
+ if list1[column] <= list3[column] >= list2[column]:
30
30
 
31
- list0[i] = 3
31
+ list0[column] = 3
32
32
 
33
33
  print(list0)
34
34
 

1

元コードの修正案追記

2020/02/06 06:05

投稿

shiracamus
shiracamus

スコア5406

test CHANGED
@@ -1,3 +1,43 @@
1
+ やりたいのはこうじゃないかな?
2
+
3
+
4
+
5
+ ```python
6
+
7
+ list1 = [7, 4, 3]
8
+
9
+ list2 = [2, 1, 8]
10
+
11
+ list3 = [9, 3, 1]
12
+
13
+ list0 = [0] * 3
14
+
15
+ for i in range(3):
16
+
17
+ if list2[i] <= list1[i] >= list3[i]:
18
+
19
+ list0[i] = 1
20
+
21
+ for i in range(3):
22
+
23
+ if list1[i] <= list2[i] >= list3[i]:
24
+
25
+ list0[i] = 2
26
+
27
+ for i in range(3):
28
+
29
+ if list1[i] <= list3[i] >= list2[i]:
30
+
31
+ list0[i] = 3
32
+
33
+ print(list0)
34
+
35
+ ```
36
+
37
+
38
+
39
+
40
+
1
41
  もっと簡単にできますよ。
2
42
 
3
43