Core Python Data Structures and Control Flow

Tuple Indexing Tuples support both forward and reverse indexing: data = (10, 20, 30, 40, 50) print(data[0]) # Output: 10 print(data[-1]) # Output: 50 Nested tuples can be accessed using multiple indices: matrix = ((1, 2, 3), (4, 5, 6)) print(matrix[0][1]) # Output: 2 Iteration Iterate over sequences using while or for: values = (5, 10, 15 ...

Posted on Thu, 07 May 2026 11:11:06 +0000 by NerdConcepts