Q:

Python | Demonstrate an Example of continue statement

belongs to collection: Python basic programs

0

continue is a keyword in python just like another programming language and it is used to send the program’s section to loop by escaping the execution of next statement in the loop.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Example 1:

for i in range(1,11):
    if(i==6):
        continue
    print(i)

Output

1
2
3
4
5
7
8
9
10

Example 2: In this example, we are printing character by character of the value/string “Hello world” and continuing the loop execution, if the character is space.

for ch in "Hello world":
    if ch == " ":
        continue
    print(ch)

Output

H
e
l
l
o
w
o
r
l
d

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Python basic programs

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Python | Demonstrate an Example of pass statement... >>
<< Python | Demonstrate an Example of break statement...