Python Tuple Data Structure

Python Tuple Data Structure

Instructor-svgAl-Mamun Sarkar
Mar 28 , 2020

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)

 

  • Share On:
  • fb
  • twitter
  • pinterest
  • instagram