Basic Tuple Operations in Python
Python tuples are another data structure like Lists. It is a sequence of immutable objects means while you can change the value of one or more items in a list, you can’t change the values in a tuple. Tuple uses parentheses to define its elements whereas lists use square brackets.
Creating Python Tuples:
It has the following syntax:
Tup1=(val1, val2, val3,....)
Nested Tuples:
A nested Tuple is a tuple inside another tuple.
Example:
Toppers=(("Sourav", "B.Tech", 95.0), ("Rakhi","BSC", 99.0), ("Sukumar", "B.Tech", 90.0)) for i in Toppers: print(i)
Output: