Write a Python program to reverse a given tuple. [You are not allowed to use tuple slicing] =================================================================== Note: Unlike lists, tuples are...


Write a Python program to reverse a given tuple.


[You are not allowed to use tuple slicing]


===================================================================



Note:Unlike lists, tuples are immutable. So, in order to reverse a tuple, we may need to convert it into a list first, then modify the list, and finally convert it back to a tuple.


===================================================================



Example 1:


Given tuple: ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h')



Output:


('h', 'g', 'f', 'e', 'd', 'c', 'b', 'a')


===================================================================



Example 2:


Given tuple: (10, 20, 30, 40, 50, 60)



Output:


(60, 50, 40, 30, 20, 10)



Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here