回答編集履歴
3
修正
test
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
3.6で導入された[フォーマット済み文字列リテラル](https://docs.python.jp/3/reference/lexical_analysis.html#f-strings)が適していると思います。
|
2
2
|
|
3
3
|
```Python
|
4
|
+
|
5
|
+
x = int(input())
|
6
|
+
|
7
|
+
y = int(input())
|
4
8
|
|
5
9
|
print(f'{x}+{y}={x+y}')
|
6
10
|
|
@@ -12,6 +16,10 @@
|
|
12
16
|
|
13
17
|
```Python
|
14
18
|
|
19
|
+
x = int(input())
|
20
|
+
|
21
|
+
y = int(input())
|
22
|
+
|
15
23
|
print('{0}+{1}={2}'.format(x, y, x+y))
|
16
24
|
|
17
25
|
```
|
2
リンクの追加
test
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
|
10
10
|
|
11
|
-
少し古いPython
|
11
|
+
少し古いPythonをご利用の場合は、[str.format](https://docs.python.jp/3/library/stdtypes.html#str.format)が適しているでしょう。
|
12
12
|
|
13
13
|
```Python
|
14
14
|
|
1
追記
test
CHANGED
@@ -1,7 +1,17 @@
|
|
1
|
-
|
1
|
+
3.6で導入された[フォーマット済み文字列リテラル](https://docs.python.jp/3/reference/lexical_analysis.html#f-strings)が適していると思います。
|
2
2
|
|
3
3
|
```Python
|
4
4
|
|
5
5
|
print(f'{x}+{y}={x+y}')
|
6
6
|
|
7
7
|
```
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
少し古いPython3.xをご利用の場合は、str.formatが適しているでしょう。
|
12
|
+
|
13
|
+
```Python
|
14
|
+
|
15
|
+
print('{0}+{1}={2}'.format(x, y, x+y))
|
16
|
+
|
17
|
+
```
|