Python Tuples Practice Questions with Solutions

Tuples are ordered and immutable collections in Python. They are used to store multiple values that should not be modified after creation. In this Python Tuples practice questions with solutions set, you’ll learn tuple creation, indexing, slicing, packing, unpacking, and commonly used tuple functions through beginner-friendly questions with complete solutions.


1. Python Program to Create and Print a Tuple

Difficulty: Foundation

Problem Statement

Write a Python program to create a tuple of five programming languages and print it.

Python Solution

languages = ("Python", "Java", "C++", "JavaScript", "SQL")

print(languages)

Sample Output

('Python', 'Java', 'C++', 'JavaScript', 'SQL')

Explanation

A tuple stores multiple values inside parentheses ().

Concepts Covered

  • Tuple Creation
  • Tuple Syntax

2. Python Program to Access Tuple Elements

Difficulty: Foundation

Problem Statement

Write a Python program to print the first, second, and last element of a tuple.

Python Solution

fruits = ("Apple", "Banana", "Orange", "Mango")

print("First:", fruits[0])
print("Second:", fruits[1])
print("Last:", fruits[-1])

Sample Output

First: Apple
Second: Banana
Last: Mango

Explanation

Tuple elements are accessed using positive and negative indexing.

Concepts Covered

  • Tuple Indexing
  • Negative Indexing

3. Python Program to Find the Length of a Tuple

Difficulty: Foundation

Problem Statement

Write a Python program to find the total number of elements in a tuple.

Python Solution

numbers = (10, 20, 30, 40, 50)

print("Length:", len(numbers))

Sample Output

Length: 5

Explanation

The len() function returns the number of items in the tuple.

Concepts Covered

  • len()

4. Python Program to Check Whether an Item Exists in a Tuple

Difficulty: Foundation

Problem Statement

Write a Python program to check whether "Python" exists in a tuple.

Python Solution

courses = ("Python", "Java", "C++")

if "Python" in courses:
    print("Course Found")
else:
    print("Course Not Found")

Sample Output

Course Found

Explanation

The in operator checks whether an item exists in the tuple.

Concepts Covered

  • Membership Operator

5. Python Program to Count the Occurrences of an Element

Difficulty: Practice

Problem Statement

Write a Python program to count how many times 20 appears in a tuple.

Python Solution

numbers = (10, 20, 30, 20, 40, 20)

print(numbers.count(20))

Sample Output

3

Explanation

The count() method returns the total occurrences of an element.

Concepts Covered

  • count()

6. Python Program to Find the Index of an Element

Difficulty: Practice

Problem Statement

Write a Python program to find the index of "Java" in a tuple.

Python Solution

courses = ("Python", "Java", "C++", "SQL")

print(courses.index("Java"))

Sample Output

1

Explanation

The index() method returns the position of the first matching element.

Concepts Covered

  • index()

7. Python Program to Slice a Tuple

Difficulty: Practice

Problem Statement

Write a Python program to print the first three elements of a tuple.

Python Solution

numbers = (10, 20, 30, 40, 50)

print(numbers[:3])

Sample Output

(10, 20, 30)

Explanation

Tuple slicing returns a new tuple containing the selected elements.

Concepts Covered

  • Tuple Slicing

8. Python Program to Pack and Unpack a Tuple

Difficulty: Challenge

Problem Statement

Write a Python program to create a tuple using packing and then unpack its values into separate variables.

Python Solution

student = ("Alex", 21, "Python")

name, age, course = student

print(name)
print(age)
print(course)

Sample Output

Alex
21
Python

Explanation

Packing groups multiple values into a tuple, while unpacking assigns them to individual variables.

Concepts Covered

  • Tuple Packing
  • Tuple Unpacking

9. Python Program to Concatenate Two Tuples

Difficulty: Challenge

Problem Statement

Write a Python program to join two tuples.

Python Solution

tuple1 = (1, 2, 3)
tuple2 = (4, 5, 6)

result = tuple1 + tuple2

print(result)

Sample Output

(1, 2, 3, 4, 5, 6)

Explanation

The + operator combines two tuples into one.

Concepts Covered

  • Tuple Concatenation

10. Python Program to Find the Maximum and Minimum Value in a Tuple

Difficulty: Challenge

Problem Statement

Write a Python program to find the largest and smallest values in a tuple.

Python Solution

numbers = (25, 10, 85, 42, 60)

print("Maximum:", max(numbers))
print("Minimum:", min(numbers))

Sample Output

Maximum: 85
Minimum: 10

Explanation

The max() and min() functions return the largest and smallest values in a tuple.

Concepts Covered

  • max()
  • min()

Chapter Summary

After completing this chapter, you have learned:

  • Creating tuples
  • Tuple indexing
  • Negative indexing
  • Tuple slicing
  • Tuple packing and unpacking
  • len()
  • count()
  • index()
  • Tuple concatenation
  • max() and min()

Written by Shubhranshu Shekhar, who has trained 20000+ students in coding.

Scroll to Top