Python Lab Assignment
Chapter-8
Tuples in Python
- 1. Write a Python program to Reverse the tuple
- 2. Counts the number of occurrences of item 10 from a tuple
- 3. Write a Python program to unpack a tuple into several variables.
- 4. Write a Python program to create a tuple of numbers and print one item.
- 5. Write a Python program to add an item to a tuple.
- 6. Write a Python program to convert a tuple to a string.
- 7. Write a Python program to get the 4th element from the last element of a tuple.
- 8. Write a Python program to check whether an element exists within a tuple.
- 9. Write a Python program to convert a list to a tuple.
- 10. Write a Python program to remove an item from a tuple.
- 11. Write a Python program to convert a tuple to a dictionary.
- 12. Write a Python program to unzip a list of tuples into individual lists.
- 13. Write a Python program to convert a list of tuples into a dictionary.
-
14. Write a Python program to replace the last value of tuples in a list.
Sample list: [(10, 20, 40), (40, 50, 60), (70, 80, 90)]
Expected Output: [(10, 20, 100), (40, 50, 100), (70, 80, 100)] - 15. Write a Python program to count the elements in a list until an element is a tuple.