logo

Tuple

Tuple: a finite ordered list (sequence) of elements.

Python

Create an empty tuple

>>> t = ()
>>> type(t)
<class 'tuple'>

Compare the following 2, the difference is the comma(,)

>>> t = ("python")
>>> type(t)
<class 'str'>

>>> t = ("python",)
>>> type(t)
<class 'tuple'>

Rust

let tuple = (1, "a", 0.1, true);