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

Pythonで「タプルを作成する」の動作を確認してみた

Posted at

概要

Pythonで「タプルを作成する」の動作を確認してみました。以下のページを参考にしました。

実装

以下のファイルを作成しました。

sample.py
x = 9
y = 18
numtuple = (x, y)
print(numtuple)

numlist = (9, 18)
print(numlist)

x = 9
y = 18
numtuple = (x, y)
print(numtuple)

x = 20
print(numtuple)

numtuple = (0,) * 10
print(numtuple)

numtuple = (10, 20, 30) * 3
print(numtuple)

以下のコマンドを実行しました。

$ python3 sample.py 
(9, 18)
(9, 18)
(9, 18)
(9, 18)
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
(10, 20, 30, 10, 20, 30, 10, 20, 30)

まとめ

何かの役に立てばと。

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