回答編集履歴

4

ファイル名生成処理変更

2019/12/03 01:30

投稿

shiracamus
shiracamus

スコア5406

test CHANGED
@@ -1,12 +1,10 @@
1
1
  ```python
2
2
 
3
- filenames = [f'file{i}.txt' for i in range(100)]
3
+ for i in range(100):
4
4
 
5
- for filename in filenames:
5
+ with open(f"file{i}.txt") as lines:
6
6
 
7
- with open(filename) as lines:
8
-
9
- xy = [[*map(float, line.split())] for line in lines]
7
+ xy = [[*map(int, line.split())] for line in lines]
10
8
 
11
9
  x, y = zip(*xy)
12
10
 

3

intをfloatに変更

2019/12/03 01:30

投稿

shiracamus
shiracamus

スコア5406

test CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  with open(filename) as lines:
8
8
 
9
- xy = [[*map(int, line.split())] for line in lines]
9
+ xy = [[*map(float, line.split())] for line in lines]
10
10
 
11
11
  x, y = zip(*xy)
12
12
 

2

中間結果のmapをリストにする

2019/12/03 01:23

投稿

shiracamus
shiracamus

スコア5406

test CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  with open(filename) as lines:
8
8
 
9
- xy = [map(int, line.split()) for line in lines]
9
+ xy = [[*map(int, line.split())] for line in lines]
10
10
 
11
11
  x, y = zip(*xy)
12
12
 

1

言語をPythonに変更

2019/12/03 01:21

投稿

shiracamus
shiracamus

スコア5406

test CHANGED
@@ -1,4 +1,4 @@
1
- ```py
1
+ ```python
2
2
 
3
3
  filenames = [f'file{i}.txt' for i in range(100)]
4
4