Tuples are defined using parentheses and can contain mixed data types. They are immutable, meaning the values inside cannot be changed. Tuples can store lists and be accessed using indexes like tuple[0] to retrieve the first element. Common tuple methods include count to find the number of times an object appears in the tuple, and index to find the position of an object in the tuple.
Tuples are defined using parentheses and can contain mixed data types. They are immutable, meaning the values inside cannot be changed. Tuples can store lists and be accessed using indexes like tuple[0] to retrieve the first element. Common tuple methods include count to find the number of times an object appears in the tuple, and index to find the position of an object in the tuple.
Tuples are defined using parentheses and can contain mixed data types. They are immutable, meaning the values inside cannot be changed. Tuples can store lists and be accessed using indexes like tuple[0] to retrieve the first element. Common tuple methods include count to find the number of times an object appears in the tuple, and index to find the position of an object in the tuple.
>> It is defined by paranthasis i.e. round bracket
>> It may consist of list in the structure >> It can have mixed DataType tuple = ('Prathmesh' 25, 4,52,5,8,'Kushwaha') >> .count(Object) >> used to count no. of repeatation of given onbject >> .index(Object) >> used to find the index of given object >> It is immutable
'Kushwaha') print('Name of the Candidate : %s %s' %(tuple[0], tuple[1])) print(f"Father's Name : %s %s" %(tuple[4][0], tuple[4][1])) print('Age of the Candidate : {}'.format(tuple[2])) print('Age of the Father : {}'.format(tuple[4][2])) print('Religion : %s' %(tuple[5])) print(f'Cast : {tuple[6]}')
Output :
Name of the Candidate : Prathmesh Kushwaha
Father's Name : Shivadhar Kushwaha Age of the Candidate : 25 Age of the Father : 60 Religion : Hindu Cast : Kushwaha