Python Jump Statements in Tamil | Python Tutorial For Beginners

preview_player
Показать описание
Python Jump Statements are divided into 3 types. They are- break, continue and pass.

Python Jump Statements - BREAK STATEMENT:
break statement is used to exit from the iterative statements (loops) such as for, while. Use case of this statement terminates the execution of loop immediately, and then program execution will jump to the next statements.

SYNTAX 1:
while condition1:
statement1
statement2
if condition2:
break

SYNTAX2:
for var in sequence:
statement1
statement2
if condition:
break
Example:
list = [1,2,3,4,5,6]
s=0
c=0
for num in list:
print num
s+=num
c+=1
if(c == 3):
break
print "sum is =%d"%(s)

OUTPUT:
1
2
3
sum is =6

Python Jump Statements - CONTINUE STATEMENT:
continue statement is used to continue the loop execution i.e. to get back to the top of the iterative statements (loops) such as for, while. Use case of this statement stops the further statement execution of loop immediately.

EXAMPLE :
Below is the example for use case of continue statement. If we observe the below code, it will skip the print “count is:5” when the count reaches to 5 and take the control to the top of the while loop.
s=0
c=0
while c ( 6:
s+=c
c+=1
if(c == 5):
continue
print "count is:%d"%(c)
print "sum is:%d"%(s)

OUTPUT:
count is:1
count is:2
count is:3
count is:4
count is:6
sum is :15

Python Jump Statements - PASS STATEMENT:

pass statement is used when programmer don’t want to execute a set of code.
pass statement is null operation. So, nothing will happen when pass statement has been executed.
Mostly, programmer uses the pass statement when they don’t want to execute the code, but they want the syntactical expressions.

EXAMPLE:
for c in range(1,9):
pass

Python Training in Chennai:

Python Training in Bangalore:

Python Interview Questions & Answers :

Python Tutorial :

#PythonJumpStatementsinTamil #PythonTamil #PythonTamilTutorial
Рекомендации по теме
welcome to shbcf.ru