reversed |
| reversed(seq) |
Returns a reverse iterator (built-in). |
| seq | The array of strings to be searched (1-dimensional) (Variant / Array) |
| REMARKS |
| * This is a built-in function. * Return a reverse iterator. seq must be an object which has a __reversed__() method or supports the sequence protocol (the __len__() method and the __getitem__() method with integer arguments starting at 0). * For the Official documentation refer to python.org |
# for string
seqString = 'Python'
print(list(reversed(seqString))) #= ['n', 'o', 'h', 't', 'y', 'P']
# for tuple
seqTuple = ('P', 'y', 't', 'h', 'o', 'n')
print(list(reversed(seqTuple))) #= ['n', 'o', 'h', 't', 'y', 'P']
# for range
seqRange = range(5, 9)
print(list(reversed(seqRange))) #= [8, 7, 6, 5]
# for list
seqList = [1, 2, 4, 3, 5]
print(list(reversed(seqList))) #= [5, 3, 4, 2, 1]
© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited Top