1
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?

変数の入れ替え (paizaランク D 相当)

Last updated at Posted at 2023-12-19

以前、コメントで教えてもらった方法でやってみる。

X,Y=map(int,input().split())
X,Y = Y,X
print(X,Y)

一発OKでした
これすっごく便利ですね。

次に行ってみる

これもさっきので解けます

N = int(input())
A = [int(input()) for _ in range(N)]
X,Y = map(int, input().split())
A[X-1],A[Y-1] = A[Y-1],A[X-1]
print(*A,sep="\n")
1
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
1
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?