0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

2 つの文字列を出力 Python3編

Posted at

今回の問題はこれ
https://paiza.jp/works/mondai/stdout_primer/stdout_primer__specific_format_step1

X
Y
と順番に文字列が出力されるのでそれを
X + Y = XYという形で出力せよという問題

S = input()
T = input()
print(f"{S} + {T} = {S}{T}")

fstringはformatと比べて直感的に書けて便利だな、と思う

でもとりあえずformatでもかけるようにはしておこう(どこかで、、、役に立つ、、、はず)
formatの書き方は覚えにくいが、置き換える箇所を{}で書いて、あとで、順番に置き換える箇所のフォーマットを引数としていく感じで考えればいい

S = input()
T = input()
print("{} + {} = {}".format(S, T, S + T))

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?