Backward iteration in Python Last Updated : 11 Jul, 2025 Comments Improve Suggest changes Like Article Like Report Backward iteration in Python is traversing a sequence (like list, string etc.) in reverse order, moving from the last element to the first. Python provides various methods for backward iteration, such as using negative indexing or employing built-in functions like reversed().Using reversed() methodUse reversed() method when we simply need to loop backwards without modifying original sequence or there is no need to create a new reversed copy. Python a = [10, 20, 30, 40, 50] #Loop through the list #using reversed() to reverse the order of list for b in reversed(a): print(b) Output50 40 30 20 10 Let's explore more methods that helps to iterate backward on any iterable. Here are some common approaches:Table of ContentUsing range(N, -1, -1)Using List SlicingUsing a While Loop Using range(N, -1, -1)range function is provided with three arguments(N, -1, -1). Use this method when we need to modify elements or access their indices. Python s = "Python" # - len(s) - 1: Start at the last index # - -1: Ensures the loop stops after the first character # - -1: The step value to iterate backwards for i in range(len(s) - 1, -1, -1): print(s[i]) Outputn o h t y P Using Slicing [::-1]We can use slicing slicing notation [::-1] to reverse the order of elements in an iterable. This works for lists, tuples, and strings, but not for sets or dictionaries (since they are unordered). Python a = [1, 2, 3, 4, 5] #Loop through the List # reverse order using slicing(::-1) for item in a[::-1]: print(item) # same logic written using List comprehension # [print(item) for item in a[::-1]] Output5 4 3 2 1 Using a While Loop Using a while loop provides you control over the iteration process. This is need to manually control the index and decrement the index during each iteration to traverse the it backward. Python a = [1, 2, 3, 4, 5] i = len(a) - 1 # Start a while loop that continues # until as 'i' is greater than or equal to 0 while i >= 0: print(a[i]) i -= 1 Output5 4 3 2 1 Comment More info M manjeet_04 Follow Improve Article Tags : Python Python Programs Python loop-programs Explore Python FundamentalsPython Introduction 3 min read Input and Output in Python 4 min read Python Variables 5 min read Python Operators 5 min read Python Keywords 2 min read Python Data Types 8 min read Conditional Statements in Python 3 min read Loops in Python - For, While and Nested Loops 7 min read Python Functions 5 min read Recursion in Python 6 min read Python Lambda Functions 5 min read Python Data StructuresPython String 5 min read Python Lists 5 min read Python Tuples 4 min read Python Dictionary 3 min read Python Sets 6 min read Python Arrays 7 min read List Comprehension in Python 4 min read Advanced PythonPython OOP Concepts 11 min read Python Exception Handling 5 min read File Handling in Python 4 min read Python Database Tutorial 4 min read Python MongoDB Tutorial 2 min read Python MySQL 9 min read Python Packages 12 min read Python Modules 7 min read Python DSA Libraries 15 min read List of Python GUI Library and Packages 3 min read Data Science with PythonNumPy Tutorial - Python Library 3 min read Pandas Tutorial 6 min read Matplotlib Tutorial 5 min read Python Seaborn Tutorial 15+ min read StatsModel Library- Tutorial 4 min read Learning Model Building in Scikit-learn 8 min read TensorFlow Tutorial 2 min read PyTorch Tutorial 7 min read Web Development with PythonFlask Tutorial 8 min read Django Tutorial | Learn Django Framework 7 min read Django ORM - Inserting, Updating & Deleting Data 4 min read Templating With Jinja2 in Flask 6 min read Django Templates 7 min read Python | Build a REST API using Flask 3 min read How to Create a basic API using Django Rest Framework ? 4 min read Python PracticePython Quiz 3 min read Python Coding Practice 1 min read Python Interview Questions and Answers 15+ min read Like