py tuple

Solutions on MaxInterview for py tuple by the best coders in the world

showing results for - "py tuple"
Martina
01 Jun 2019
1# Different types of tuples
2
3# Empty tuple
4my_tuple = ()
5print(my_tuple) # ()
6
7# Tuple having integers
8my_tuple = (1, 2, 3)
9print(my_tuple) # (1, 2, 3)
10
11# tuple with mixed datatypes
12my_tuple = (1, "Hello", 3.4)
13print(my_tuple) # (1, 'Hello', 3.4)
14
15# nested tuple
16my_tuple = ("mouse", [8, 4, 6], (1, 2, 3))
17print(my_tuple) # ('mouse', [8, 4, 6], (1, 2, 3))