The program is written in Python and it modifies an element of a tuple. Initially, a tuple t1 is created containing 5 elements (10, 20, 30, 40, 50). The program then prints the original tuple t1. Next, the program converts the tuple t1 to a list l using the list() function. The program then modifies the third element of the list l by changing its value from 30 to 33. Finally, the program converts the modified list l back to a tuple t1 using the tuple() function and prints the modified tuple.
t1 = (10,20,30,40,50) print("Original Tuple :",t1) l = list(t1) l[2]=33 t1 = tuple(l) print("Modify Tuple :",t1)
Original Tuple : (10, 20, 30, 40, 50) Modify Tuple : (10, 20, 33, 40, 50)
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions