
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
Python Index specific cyclic iteration in list
In this tutorial, we are going to write a program that cyclically iterates a list from the given Let's see the steps to solve the problem
- Initialize the list and index.
- Find the length of the list using len.
- Iterate over the list using the length.
- Find the index of the element using index % length.
- Print the element.
- Increment the index.
It's a simple loop iteration. You can write it without any trouble. Let's see the code.
Example
# initializing the list and index alphabets = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] start_index = 5 # finding the length length = len(alphabets) # iterating over the list for i in range(length): # finding the index of the current element element_index = start_index % length # printing the element print(alphabets[element_index], end=' ') # incrementing the index for the next element start_index += 1
Output
If you run the above code, then you will get the following result.
f g h a b c d e
Conclusion
If you have any queries regarding the tutorial, mention them in the comment section.
- Related Articles
- Python – Check if elements in a specific index are equal for list elements
- Backward iteration in Python
- Backward iteration in Python program
- Python – Index Value repetition in List
- How do I insert elements at a specific index in Java list?
- Equate two list index elements in Python
- Python – Negative index of Element in List
- Python - Return index with a specific level removed
- How to remove index list from another list in python?
- Remove Substrings in One Iteration in python
- Python – Extract elements in between multiple specific range of index
- Python – Append List every Nth index
- C++ Program to Find Chromatic Index of Cyclic Graphs
- Accessing index and value in a Python list
- Add list elements with a multi-list based on index in Python

Advertisements