Question:

Perform the following operations on the below tuple (‘abc’, ‘def’, ‘ghi’, ‘jklm’, ‘nopqr’, ‘st’, ‘uv’, ‘wxyz’, ’23’, ‘s98’, ‘123’, ’87’)

  •  prints the length of the tuple

  • Slicing

  • Reverse all items in the tuple

  • Removing whole tuple

  • Concatenate two tuples

Program:

Explanation:

A tuple is a sequence of immutable Python objects. Tuples are sequences, just like lists. The differences between tuples and lists are, the tuples cannot be changed unlike lists and tuples use parentheses, whereas lists use square brackets.

Output:

Leave a Reply