回答編集履歴
1
iの更新を追加
answer
CHANGED
@@ -7,6 +7,7 @@
|
|
7
7
|
prices = []
|
8
8
|
while (x := input(f"{i}個目の商品の価格(円)を入力してください:")) != "q":
|
9
9
|
prices.append(int(x))
|
10
|
+
i += 1
|
10
11
|
subtotal = sum(prices)
|
11
12
|
tax = subtotal * tax_rate
|
12
13
|
total = subtotal + tax
|
@@ -24,6 +25,7 @@
|
|
24
25
|
... prices = []
|
25
26
|
... while (x := input(f"{i}個目の商品の価格(円)を入力してください:")) != "q":
|
26
27
|
... prices.append(int(x))
|
28
|
+
... i += 1
|
27
29
|
... subtotal = sum(prices)
|
28
30
|
... tax = subtotal * tax_rate
|
29
31
|
... total = subtotal + tax
|
@@ -33,9 +35,9 @@
|
|
33
35
|
...
|
34
36
|
>>> register()
|
35
37
|
1個目の商品の価格(円)を入力してください:100
|
36
|
-
|
38
|
+
2個目の商品の価格(円)を入力してください:100
|
37
|
-
|
39
|
+
3個目の商品の価格(円)を入力してください:100
|
38
|
-
|
40
|
+
4個目の商品の価格(円)を入力してください:q
|
39
41
|
小計: 300円
|
40
42
|
消費税: 30.0円
|
41
43
|
計: 330.0円
|