Categories
5G Network
Agile
Amazon EC2
Android
Angular
Ansible
Arduino
Artificial Intelligence
Augmented Reality
AWS
Azure
Big Data
Blockchain
BootStrap
Cache Teachniques
Cassandra
Commercial Insurance
C#
C++
Cloud
CD
CI
Cyber Security
Data Handling
Data using R
Data Science
DBMS
Design-Pattern
DevOps
ECMAScript
Fortify
Ethical Hacking
Framework
GIT
GIT Slack
Gradle
Hadoop
HBase
HDFS
Hibernate
Hive
HTML
Image Processing
IOT
JavaScript
Java
Jenkins
Jira
JUnit
Kibana
Linux
Machine Learning
MangoDB
MVC
NGINX
Onsen UI
Oracle
PHP
Python
QTP
R Language
Regression Analysis
React JS
Robotic
Salesforce
SAP
Selenium
Service Discovery
Service Now
SOAP UI
Spark SQL
Testing
TOGAF
Research Method
Virtual Reality
Vue.js
Home
Recent Q&A
Feedback
Ask a Question
Explain Python Continue statement
Home
>
Python
>
Explain Python Continue statement
Dec 12, 2019
in
Python
Q: Python Continue
#continue-statement
1
Answer
0
votes
Dec 12, 2019
The continue statement in python is used to bring the program control to the beginning of the loop. The continue statement skips the remaining lines of code inside the loop and start with the next iteration. It is mainly used for a particular condition inside the loop so that we can skip some specific code for a particular condition.
The syntax of Python continue statement is given below.
#loop statements
continue;
#the code to be skipped
Example 1
i = 0;
while i!=10:
print("%d"%i);
continue;
i=i+1;
Output:
infinite loop
Example 2
i=1; #initializing a local variable
#starting a loop from 1 to 10
for i in range(1,11):
if i==5:
continue;
print("%d"%i);
Output:
1
2
3
4
6
7
8
9
10
Pass Statement
The pass statement is a null operation since nothing happens when it is executed. It is used in the cases where a statement is syntactically needed but we don't want to use any executable statement at its place.
For example, it can be used while overriding a parent class method in the subclass but don't want to give its specific implementation in the subclass.
Pass is also used where the code will be written somewhere but not yet written in the program file.
The syntax of the pass statement is given below.
Example
list = [1,2,3,4,5]
flag = 0
for i in list:
print("Current element:",i,end=" ");
if i==3:
pass;
print("\nWe are inside pass block\n");
flag = 1;
if flag==1:
print("\nCame out of pass\n");
flag=0;
Output:
Current element: 1 Current element: 2 Current element: 3
We are inside pass block
Came out of pass
Current element: 4 Current element: 5
Click here to read more about Python
Click here to read more about Insurance
Facebook
Twitter
LinkedIn
Related questions
0
votes
Q: Can you please explain what is the difference between pass and continue in Python Language?
Aug 29, 2020
in
Python
#python-continye
#python-pass
0
votes
Q: Can you please help to clarify what does the continue do in Python Language?
Aug 29, 2020
in
Python
#python-continue-do
#continue-do
#python-continue-function
0
votes
Q: What is pass in Python? What are the differences between pass and continue?
Jun 12, 2020
in
Python
#python-pass
0
votes
Q: What Is The Difference Between Pass And Continue In Python?
Dec 14, 2019
in
Python
#python-continue
0
votes
Q: What Does The Continue Do In Python?
Dec 14, 2019
in
Python
#python-loop
0
votes
Q: Explain Python Break statement
Dec 12, 2019
in
Python
#break-statement
...