python what is tuple code example
Example 1: what is a tuple in python
tup1 = ('physics', 'chemistry', 1997, 2000);
tup2 = "a", "b", "c", "d";
tup1[0]
Example 2: tuples in python
letters = "a", "b", "c", "d"
print(letters)
"""
tuples are immutable but it's important because they don't returns the bugs
these are sequence types means you can iterate over them by it's index numbers
tuples data can't be changed but list's data can be changed
"""
Example 3: python tuple methods
count(x) : Returns the number of times 'x' occurs in a tuple
index(x) : Searches the tuple for 'x' and returns the position of where it was first found