1
num_tuple = (10, 20)
print(num_tuple)
1の実行結果
(10, 20)
2
x, y = 10, 20
print(x, y)
2の実行結果
10 20
タプルの展開を使って値の入れ替え
i = 10
j = 20
print(i, j)
i, j = j, i
print(i, j)
タプルの展開を使って値の入れ替えの実行結果
10 20
20 10
Go to list of users who liked
More than 3 years have passed since last update.
num_tuple = (10, 20)
print(num_tuple)
(10, 20)
x, y = 10, 20
print(x, y)
10 20
i = 10
j = 20
print(i, j)
i, j = j, i
print(i, j)
10 20
20 10
Register as a new user and use Qiita more conveniently
Go to list of users who liked