Given is a nested tuple. Write a program to modify the first item (22) of a list inside a following tuple to 222
Given:
tuple1 = (11, [22, 33], 44, 55)
Expected output:
tuple1: (11, [222, 33], 44, 55)
Hint:
The given tuple is a nested tuple. Use indexing to locate the specified item and modify it using the assignment operator.
Solution:
tuple1 = (11, [22, 33], 44, 55) tuple1[1][0] = 222 print(tuple1)
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Hint:
The given tuple is a nested tuple. Use indexing to locate the specified item and modify it using the assignment operator.
Solution:
need an explanation for this answer? contact us directly to get an explanation for this answer