- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to iterate by sequence index in Python?
Sequence objects in Python are an ordered collection of items. Each item in the sequence (list, tuple and string) is accessible by index starting with 0.
To traverse elements in a list
>>> L1=[10,20,30,40,50] >>> for i in range(len(L1)): print (L1[i]) 10 20 30 40 50
To slice one character at a time out of a string
>>> string ='TutorialsPoint' >>> for i in range(len(string)): print (string[i]) T u t o r i a l s P o i n t
- How to iterate through a dictionary in Python?
- How to iterate through a list in Python?
- How to iterate through a tuple in Python?
- How to remove an element from a list by index in Python?
- How to create a sequence increasing by 1 in R?
- How to recursively iterate a nested Python dictionary?
- Python program to compute the power by Index element in List
- Program to find array by swapping consecutive index pairs in Python
- Collatz sequence in Python
- Connell sequence in Python
- Python Sequence Types
- How to pre-select JComboBox item by index in Java?
- How to print the Fibonacci Sequence using Python?
- Iterate over a dictionary in Python
- Iterate over a list in Python