Python – Tuple Exercises
Exercise 1: Create a Tuple
Question
Create a tuple of fruits and print it.
Solution
Exercise 2: Access Tuple Items
Question
Print the first and last item of a tuple.
Solution
Exercise 3: Tuple Length
Question
Find how many items are in a tuple.
Solution
Exercise 4: Loop Through Tuple
Question
Print all items using a loop.
Solution
Exercise 5: Check Item Exists
Question
Check if "banana" is in the tuple.
Solution
Exercise 6: Count Item in Tuple
Question
Count how many times 2 appears.
Solution
Exercise 7: Find Index of Item
Question
Find the index of "orange".
Solution
Exercise 8: Unpack Tuple
Question
Unpack tuple values into variables.
Solution
Exercise 9: Update Tuple (Trick)
Question
Change "red" to "yellow" in the tuple.
Solution
Exercise 10: Add Item to Tuple
Question
Add "grape" to the tuple.
Solution
Exercise 11: Remove Item from Tuple
Question
Remove "dog" from the tuple.
Solution
Exercise 12: Join Two Tuples
Question
Join two tuples into one.
Solution
Exercise 13: Loop with Index
Question
Print index and value of tuple items.
Solution
Exercise 14: Tuple with One Item
Question
Create a tuple with one value.
Solution
Exercise 15: Swap Values Using Tuple
Question
Swap two numbers using tuple.
Solution
✅ Summary
✔ Tuples store fixed data
✔ Tuples cannot be changed directly
✔ Use index to access values
✔ Use count() and index()
✔ Use tricks to update tuple
📘 Perfect for Beginner eBook
This exercise chapter is ideal for:
-
Python beginner books
-
School & college students
-
Self-learners
If you want next, I can write:
-
Python Sets (easy)
-
Set Exercises
-
Dictionaries (easy)
-
Dictionary Exercises
Just tell me 😊
