belongs to collection: Python Tuple Exercises
The given tuple is a nested tuple. write a Python program to print the value 20.
Given:
tuple1 = ("Orange", [10, 20, 30], (5, 15, 25))
Expected output:
20
Hint:
The given tuple is a nested tuple. Use indexing to locate the specified item.
Solution:
tuple1 = ("Orange", [10, 20, 30], (5, 15, 25)) # understand indexing # tuple1[0] = 'Orange' # tuple1[1] = [10, 20, 30] # list1[1][1] = 20 print(tuple1[1][1])
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.
Solution:
need an explanation for this answer? contact us directly to get an explanation for this answer