Answers for "how to print tuple in reverse order in python"

1

reverse a tuple python

>>> x = (1, 2, 3, 4)
>>> x = tuple(reversed(x))
>>> x
(4, 3, 2, 1)
Posted by: Guest on September-13-2020
0

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)
Posted by: Guest on January-24-2021

Code answers related to "how to print tuple in reverse order in python"

Python Answers by Framework

Browse Popular Code Answers by Language