filmov
tv
#22 Python Tutorial for Beginners | Break Continue Pass in Python

Показать описание
Check out our courses:
Coupon: TELUSKO10 (10% Discount)
Coupon: TELUSKO20 (20% Discount)
Udemy Courses:
For More Queries WhatsApp or Call on : +919008963671
In this lecture we are discussing about:
#1 break
#2 continue
#3 pass
In Python, break, continue, and pass are control flow statements that are used to
alter the normal flow of execution in a loop or conditional statement.
#1
break: The break statement is used to terminate a loop prematurely when a certain condition is met.
Once the break statement is encountered inside a loop, the loop is immediately terminated and the program continues
with the next statement after the loop.
for i in range(1, 6):
if i == 3:
break
print(i)
output:
1
2
#2
continue: The continue statement is used to skip the current iteration of a loop and move on to the next iteration,
without executing the remaining code in the loop for the current iteration.
for i in range(1, 6):
if i == 3:
continue
print(i)
output:
1
2
4
5
#3
pass: The pass statement is a placeholder statement that is used to indicate that no action should be taken. It is often used
as a placeholder when writing code that will be filled in later.
for i in range(1, 6):
if i == 3:
pass
else:
print(i)
output:
1
2
4
5
Editing Monitors :
More Learning :
Donation:
PayPal Id : navinreddy20
Coupon: TELUSKO10 (10% Discount)
Coupon: TELUSKO20 (20% Discount)
Udemy Courses:
For More Queries WhatsApp or Call on : +919008963671
In this lecture we are discussing about:
#1 break
#2 continue
#3 pass
In Python, break, continue, and pass are control flow statements that are used to
alter the normal flow of execution in a loop or conditional statement.
#1
break: The break statement is used to terminate a loop prematurely when a certain condition is met.
Once the break statement is encountered inside a loop, the loop is immediately terminated and the program continues
with the next statement after the loop.
for i in range(1, 6):
if i == 3:
break
print(i)
output:
1
2
#2
continue: The continue statement is used to skip the current iteration of a loop and move on to the next iteration,
without executing the remaining code in the loop for the current iteration.
for i in range(1, 6):
if i == 3:
continue
print(i)
output:
1
2
4
5
#3
pass: The pass statement is a placeholder statement that is used to indicate that no action should be taken. It is often used
as a placeholder when writing code that will be filled in later.
for i in range(1, 6):
if i == 3:
pass
else:
print(i)
output:
1
2
4
5
Editing Monitors :
More Learning :
Donation:
PayPal Id : navinreddy20
Комментарии