print tuple element code example
Example 1: what are tuples used for
Tuples in Python
An immutable data value that contains related elements.
Tuples are used to group together related data,
such as a person’s name, their age, and their gender.
A tuple is the same as a list except uses parenthisies instead of square brackets.
A tuple is also immutable (cant be changed) unlike a list.
Example:
tup1 = ('physics', 'chemistry', 1997, 2000);
Example 2: what is a tuple in python
tup1 = ('physics', 'chemistry', 1997, 2000);
tup2 = "a", "b", "c", "d";
tup1[0]