Learn with Yasir

Share Your Feedback

Python Tuples – Fill in the Blanks Exercises for Beginners

Practice Python tuple concepts with fill-in-the-blank questions designed for beginners. Reinforce syntax, immutability, indexing, and key features of tuples through hands-on exercises.

Topic: tuples


🔍 Fill in the Blanks

🟢 Beginner

  1. Tuples are ______ sequences, meaning they cannot be changed after creation.
  2. Answer

    immutable

    Unlike lists, tuples cannot be modified after creation (no adding, removing, or changing elements).


  3. To create a tuple with a single element, you must include a ______ after the element: (5,)
  4. Answer

    comma

    The comma distinguishes a single-element tuple from a parenthesized expression.


  5. The two built-in tuple methods are ______() and ______().
  6. Answer

    count, index

    count() returns occurrences of a value, index() returns first occurrence's position.


  7. The ______ function converts a list to a tuple: tuple([1, 2, 3]).
  8. Answer

    tuple()

    The tuple() constructor creates tuples from iterables like lists.


🟡 Intermediate

  1. The slice tuple[1:4] will return elements at indices ______, ______, and ______.
  2. Answer

    1, 2, 3

    Slicing is exclusive of the end index, so it stops before index 4.


  3. To concatenate two tuples, you use the ______ operator: tuple1 + tuple2.
  4. Answer

    +

    The + operator combines tuples into a new tuple.


  5. To create an empty tuple, you use empty parentheses: ______.
  6. Answer

    ()

    Empty parentheses create an empty tuple, unlike {} which creates a dictionary.


  7. To get every second element of a tuple: tuple[______:______:______].
  8. Answer

    0, len(tuple), 2

    The slice [start:stop:step] with step=2 selects every other element.


🔴 Advanced

  1. The expression tuple[______] returns the last element of a tuple.
  2. Answer

    -1

    Negative indices count from the end (-1 is last, -2 is second last, etc.).


  3. Tuple unpacking allows assigning tuple elements to variables like: x, y, z = ______.
  4. Answer

    tuple_name

    The number of variables must match the tuple length (or use * for remaining items).




📚 Related Resources