Print the reversed tuple in python program

Print the reversed tuple in the python program. This tuple reverse program is not only for particular data types in python program, it works for every data type in tuple. Reversing a list in the middle of it. reverse() is a function that allows you to reverse the direction of To make a reversed copy, use the “ [::-1] ” list slicing technique. Using the reversed() built-in method to create a reverse iterator.

a = ("Inlarn.com")
b = reversed(a)
print(tuple(b))
a = (1,45,67,65)
b = reversed(a)
print(tuple(b))

 

Output:

(‘m’, ‘o’, ‘c’, ‘.’, ‘n’, ‘r’, ‘a’, ‘l’, ‘n’, ‘I’)                                                                              

(65, 67, 45, 1)