0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

タプルのアンパッキング

Posted at
num_tuple = (10, 20)
print(num_tuple)

#タプルのアンパッキング
x, y = num_tuple #xとyにそれぞれ10,20が入る
print(x, y)

#タプルのアンパッキングを利用した変数の入れ替え
i = 10
j = 20
i, j = j, i
print(i, j)

実行結果:

(10, 20)
10 20
20 10
0
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?