回答編集履歴
4
追記
test
CHANGED
@@ -55,3 +55,23 @@
|
|
55
55
|
"""[1:-1]))
|
56
56
|
|
57
57
|
```
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
あるいは
|
62
|
+
|
63
|
+
---
|
64
|
+
|
65
|
+
number1からnumber5をリストで管理できていたなら、もっと簡潔に書けます。
|
66
|
+
|
67
|
+
```Python
|
68
|
+
|
69
|
+
numbers = [int(input()) for _ in range(5)]
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
for n1, n2 in zip(numbers, numbers[1:]):
|
74
|
+
|
75
|
+
print(n1+n2)
|
76
|
+
|
77
|
+
```
|
3
追記
test
CHANGED
@@ -38,6 +38,10 @@
|
|
38
38
|
|
39
39
|
```Python
|
40
40
|
|
41
|
+
import textwrap
|
42
|
+
|
43
|
+
|
44
|
+
|
41
45
|
print(textwrap.dedent(f"""
|
42
46
|
|
43
47
|
{number1+number2}
|
2
追記
test
CHANGED
@@ -29,3 +29,25 @@
|
|
29
29
|
{number4+number5}''')
|
30
30
|
|
31
31
|
```
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
---
|
36
|
+
|
37
|
+
ついでに種々の個人的趣向も炸裂させると、こう。
|
38
|
+
|
39
|
+
```Python
|
40
|
+
|
41
|
+
print(textwrap.dedent(f"""
|
42
|
+
|
43
|
+
{number1+number2}
|
44
|
+
|
45
|
+
{number2+number3}
|
46
|
+
|
47
|
+
{number3+number4}
|
48
|
+
|
49
|
+
{number4+number5}
|
50
|
+
|
51
|
+
"""[1:-1]))
|
52
|
+
|
53
|
+
```
|
1
追記
test
CHANGED
@@ -11,3 +11,21 @@
|
|
11
11
|
{number4+number5}''')
|
12
12
|
|
13
13
|
```
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
なおバックスラッシュに依る改行のエスケープを併用すれば、見た目の気持ち悪さも減ります。
|
18
|
+
|
19
|
+
```Python
|
20
|
+
|
21
|
+
print(f'''\
|
22
|
+
|
23
|
+
{number1+number2}
|
24
|
+
|
25
|
+
{number2+number3}
|
26
|
+
|
27
|
+
{number3+number4}
|
28
|
+
|
29
|
+
{number4+number5}''')
|
30
|
+
|
31
|
+
```
|