 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Looping Techniques in Python
In this tutorial, we will learn about looping techniques in python 3.x. Or earlier. There are many ways in which we can implement loops. Here we will be discussing four techniques in looping.
Enumeration construct
Example
# enumerate() type for index, value in enumerate(['Tutorial','point']): print(index, value)
Output
0 Tutorial 1 point
Zip construct
Example
# zip() method arr1 = ['Tutorial','point'] arr2 = ['python','loops'] for i,j in zip(arr1, arr2): print(i,j)
Output
Tutorial python point loops
Membership construct
Example
# membership operator for i in ['Tutorial','point']: print(i)
Output
Tutorial point
Infinitive construct
Example
# infinite loop while(True): pass
Step - based construct
Example
# range with step incrementer For i in range(0,4,2): print(i)
Output
0 2
Conclusion
In this article, we learned about Looping Techniques in Python 3.x. Or earlier.
Advertisements
 