Python Tuple Data Structure

Author: Al-mamun Sarkar Date: 2020-03-28 13:49:36

Python Tuple Data Structure. The tuple is an immutable data structure. That means you can not change the values. The following code shows how to use tuple in the Python programming language.

Code:

if __name__ == "__main__":
    my_tup1 = ('English', 'Bangla', 1980, 2010)
    py_tup2 = (10, 20, 30, 40, 50, 60, 70)
    print("my_tup1[0]: ", my_tup1[0])
    print("py_tup2[1:5]: ", py_tup2[1:5])

 

Output:

my_tup1[0]:  English
py_tup2[1:5]:  (20, 30, 40, 50)