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