質問編集履歴

2

エラーの部分を編集しました

2021/07/24 07:35

投稿

bbiiq
bbiiq

スコア51

test CHANGED
File without changes
test CHANGED
@@ -58,20 +58,22 @@
58
58
 
59
59
  ```python
60
60
 
61
- 37 else:
61
+ 38 else:
62
-
62
+
63
- 38 for i in range(0,len(tournament),1):
63
+ 39 for i in range(0,len(eva),1):
64
-
64
+
65
- ---> 39 if tournament[i] < tournament[i+1]:
65
+ ---> 40 if eva[i] < eva[i+1]:
66
-
66
+
67
- 40 del tournament[i]
67
+ 41 tournament.append(eva[i])
68
-
68
+
69
- 41 else:
69
+ 42 else:
70
70
 
71
71
 
72
72
 
73
73
  IndexError: list index out of range
74
74
 
75
+
76
+
75
77
  ```
76
78
 
77
79
 

1

質問内容を変更した

2021/07/24 07:35

投稿

bbiiq
bbiiq

スコア51

test CHANGED
File without changes
test CHANGED
@@ -16,42 +16,40 @@
16
16
 
17
17
  random.shuffle(eva)
18
18
 
19
- tournament = eva
19
+ tournament = [()]
20
-
20
+
21
- while len(tournament) > 1:
21
+ while len(eva) > 1:
22
-
22
+
23
- if len(tournament) % 2 != 0:
23
+ if len(eva) % 2 != 0:
24
-
24
+
25
- for i in range(1,len(tournament),1):
25
+ for i in range(1,len(eva),1):
26
-
26
+
27
- if tournament[i] < tournament[i+1]:
27
+ if eva[i] < eva[i+1]:
28
-
28
+
29
- del tournament[i]
29
+ tournament.append(eva[i])
30
30
 
31
31
  else:
32
32
 
33
+ tournament.append(eva[i+1])
34
+
33
- del tournament[i+1]
35
+ eva = tournament
34
36
 
35
37
  else:
36
38
 
37
- for i in range(0,len(tournament),1):
39
+ for i in range(0,len(eva),1):
38
-
40
+
39
- if tournament[i] < tournament[i+1]:
41
+ if eva[i] < eva[i+1]:
40
-
42
+
41
- del tournament[i]
43
+ tournament.append(eva[i])
42
44
 
43
45
  else:
44
46
 
47
+ tournament.append(eva[i+1])
48
+
45
- del tournament[i+1]
49
+ eva = tournament
46
-
47
-
48
50
 
49
51
  return tournament
50
52
 
51
-
52
-
53
-
54
-
55
53
  ```
56
54
 
57
55
 
@@ -156,35 +154,37 @@
156
154
 
157
155
  random.shuffle(eva)
158
156
 
159
- tournament = eva
157
+ tournament = [()]
160
-
158
+
161
- while len(tournament) > 1:
159
+ while len(eva) > 1:
162
-
160
+
163
- if len(tournament) % 2 != 0:
161
+ if len(eva) % 2 != 0:
164
-
162
+
165
- for i in range(1,len(tournament),1):
163
+ for i in range(1,len(eva),1):
166
-
164
+
167
- if tournament[i] < tournament[i+1]:
165
+ if eva[i] < eva[i+1]:
168
-
166
+
169
- del tournament[i]
167
+ tournament.append(eva[i])
170
168
 
171
169
  else:
172
170
 
171
+ tournament.append(eva[i+1])
172
+
173
- del tournament[i+1]
173
+ eva = tournament
174
174
 
175
175
  else:
176
176
 
177
- for i in range(0,len(tournament),1):
177
+ for i in range(0,len(eva),1):
178
-
178
+
179
- if tournament[i] < tournament[i+1]:
179
+ if eva[i] < eva[i+1]:
180
-
180
+
181
- del tournament[i]
181
+ tournament.append(eva[i])
182
182
 
183
183
  else:
184
184
 
185
+ tournament.append(eva[i+1])
186
+
185
- del tournament[i+1]
187
+ eva = tournament
186
-
187
-
188
188
 
189
189
  return tournament
190
190