YouTube / video information
L12 :๐Jump Statements in Python | break, continue & pass | Python Programming
Video information, playback and saved actions.
Description: Hello everyone ๐
Welcome to Carrier With Code (CWC)
In this lecture, we will learn Jump Statements in Python with simple explanations and practical examples.
Jump statements are used to change the normal flow of a loop or program.
In this video, we will understand:
โ
What are Jump Statements?
โ
break statement
โ
continue statement
โ
pass statement
โ
Difference between break, continue and pass
โ
Practical Python programs
โ
Real-life examples
๐น 1. What are Jump Statements?
Jump statements are statements that change the normal flow of program execution.
In Python, commonly used statements are:
break
continue
pass
They are especially useful while working with loops and conditional statements.
๐น 2. break Statement
The break statement is used to completely stop a loop.
When Python encounters break, the loop terminates immediately.
Syntax
break
Example
for i in range(1, 11):
if i == 5:
break
print(i)
Output
1
2
3
4
Explanation
When i becomes 5, the break statement runs.
The loop completely stops, so 5 to 10 are not printed.
Easy Meaning
break = Stop the loop
๐น 3. continue Statement
The continue statement is used to skip the current iteration and move to the next iteration of the loop.
Syntax
continue
Example
for i in range(1, 6):
if i == 3:
continue
print(i)
Output
1
2
4
5
Explanation
When i becomes 3, continue skips that iteration.
The loop does not stop. It continues with the next value.
Easy Meaning
continue = Skip current iteration
๐น 4. pass Statement
The pass statement is used when we want to write a block of code that currently does nothing.
It acts as a placeholder.
Syntax
pass
Example
for i in range(1, 6):
if i == 3:
pass
print(i)
Output
1
2
3
4
5
Explanation
pass does not stop the loop and does not skip the iteration.
It simply means:
"Do nothing for now."
๐น 5. Difference Between break, continue and pass
break continue pass
Stops the loop Skips current iteration Does nothing
Loop terminates Loop continues Program continues normally
Used to exit a loop Used to skip an iteration Used as a placeholder
Example: stop at 5 Example: skip 3 Example: empty block
๐ง Easy Trick
Remember:
BREAK โ STOP ๐
CONTINUE โ SKIP โก๏ธ
PASS โ DO NOTHING โ
๐น 6. Practical Example โ break
Print numbers from 1 to 10 but stop when the number becomes 6.
for i in range(1, 11):
if i == 6:
break
print(i)
Output
1
2
3
4
5
๐น 7. Practical Example โ continue
Print numbers from 1 to 10 but skip number 5.
for i in range(1, 11):
if i == 5:
continue
print(i)
Output
1
2
3
4
6
7
8
9
10
๐น 8. Practical Example โ pass
for i in range(1, 6):
if i == 3:
pass
print(i)
Output
1
2
3
4
5
๐ Real-Life Example
Imagine you are checking students one by one.
break
You find the student you were looking for โ stop checking.
continue
One student is absent โ skip that student and check the next one.
pass
You reach a situation where you don't want to perform any action for now.
โก Quick Revision Table
Statement Meaning Effect
break Stop Terminates loop
continue Skip Skips current iteration
pass Do nothing Acts as placeholder
๐ฏ After This Lecture You Will Be Able To
โ
Understand jump statements
โ
Use break in loops
โ
Use continue in loops
โ
Understand the purpose of pass
โ
Differentiate between break, continue and pass
โ
Write practical Python programs using jump statements
๐จโ๐ป This Lecture Is Perfect For
Python Beginners
BCA Students
Python Practical Preparation
College Assignments
Viva Preparation
Python Programming Learners
๐ SEO Keywords
jump statements in python
break statement in python
continue statement in python
pass statement in python
break continue pass python
python loops
python control statements
python programming for beginners
python practical
python programming BCA
learn python
python tutorial
python examples
#๏ธโฃ Hashtags
#Python
#PythonProgramming
#PythonForBeginners
#PythonTutorial
#BreakInPython
#ContinueInPython
#PassInPython
#PythonLoops
#BCA
#BCAStudents
#Programming
#CarrierWithCode
#CWC
#carrierwithcodeย
Close description