how to print tuple in reverse code example
Example 1: reverse a tuple python
>>> x = (1, 2, 3, 4)
>>> x = tuple(reversed(x))
>>> x
(4, 3, 2, 1)
Example 2: how to print tuple in reverse order in python
languages = ('C++', 'Python', 'Scratch')
#Method1:
languages = tuple(reversed(languages))
print(languages)
#Method2:
lang = languages[::-1]
print(lang)