teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

3

修正

2018/01/14 09:28

投稿

LouiS0616
LouiS0616

スコア35678

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

リンクの追加

2018/01/14 09:28

投稿

LouiS0616
LouiS0616

スコア35678

answer CHANGED
@@ -3,7 +3,7 @@
3
3
  print(f'{x}+{y}={x+y}')
4
4
  ```
5
5
 
6
- 少し古いPython3.xをご利用の場合は、str.formatが適しているでしょう。
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

追記

2018/01/14 09:26

投稿

LouiS0616
LouiS0616

スコア35678

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
  ```