How Can We Help?
This tutorial will explain how to pass the loop in Python by giving practical examples for better understanding.
What is Pass Statement in Python?
The pass statement is a “null” statement and does not operate like the name. We use it to bypass any code. It just makes the control bypass without executing any code, which means we use the pass statement when we do not want to execute any code. We can use the pass statement in the while loop and for loop statements.
Python Pass Loop Syntax
loop_expression:
body of loop
pass
Python Pass Loop Example
for i in 'web':
pass
print(i)
Output:
1
3
Explanation:
In the above example, for loop is iterating three times, and after the third iteration, i=b, the output shows ‘b’ against executing the print statement as “print(i)” outside the loop.
Conclusion
This tutorial taught us how to use loop pass statements in Python.
If you have an inquiry or doubt don’t hesitate to leave them in the comment section. we are waiting for your feedback.
But remember to understand the concept very well, you need to practice more.
Hopefully, it was clear and concise.
Python Tutorials List:
- Python tutorials list : access all python tutorials.