質問編集履歴

1

情報の追加(自分で書いたコードなど)

2019/03/23 07:19

投稿

zynu
zynu

スコア29

test CHANGED
File without changes
test CHANGED
@@ -1,3 +1,35 @@
1
+ a1,b1,c1,d1
2
+
3
+ ...
4
+
5
+ aN,bN,cN,dN
6
+
7
+ こんな感じで横に入力される個数がわかっていれば対応できるのですが、
8
+
9
+ a = list()
10
+
11
+ b = list()
12
+
13
+ c = list()
14
+
15
+ d = list()
16
+
17
+ for _ in range(N):
18
+
19
+ A, B, C, D = (int(x) for x in input("初乗り距離、運賃・加算、距離運賃:").split())
20
+
21
+ a.append(A)
22
+
23
+ b.append(B)
24
+
25
+ c.append(C)
26
+
27
+ d.append(D)
28
+
29
+
30
+
31
+
32
+
1
33
  e11………e1n
2
34
 
3
35
  … ...
@@ -9,3 +41,23 @@
9
41
  自分でやった時はinput().split()とfor文を組み合わせて、リストに1行ずつ入れ子で入れていこうと思ったのですができませんでした。
10
42
 
11
43
  やり方を教えて下さい!
44
+
45
+ M = int(input())
46
+
47
+
48
+
49
+ list_N = list()
50
+
51
+ list_M = list()
52
+
53
+ for _ in range(M):
54
+
55
+ list_N.append(int(x) for x in input("データをいれてね:").split())
56
+
57
+ list_M.append(list_N.copy())
58
+
59
+ list_N.clear()
60
+
61
+
62
+
63
+ これが自分で書いたコード(修正版)です。