Java, .NET, PHP, PYTHON, ANGULAR, .NET, ML, Data Scince, Testing, CI Tutorials in Easy Languages.

"Best Software Training, Internship, Project Development center of Indore India, Helpline 780506-3968"

Break,Continue and Pass Statement in Python:-



Break:-   It is used to manually terminate the loop based on condition ,break statement always will be defined by Conditional Statement in Loop.


for i in range(1,10):
      if i==3:
         break;
      print(i)


output :-  1
                2

Continue:-   It is used to skip the particular data from loop and continue process of loop.

 for i in range(1,10):
    if i==3:
       continue
   print(i)


output:-  1
               2
               4
               5
               6
               7
               8
              9


important question of break and continue:-

for i in range(1,10):
    if i==3 and i==5:
      continue
    print(i)
print("hello")
 
  ..................................
for i in range(1,10):
    if i==3 and i==5:
      break
    print(i)
print("hello")
    
    
for i in range(1,10):
    if i==3 or i==5:
      continue
    print(i)
print("hello")
    
    
........................................................................

pass :-  it is used to define empty block in python because python not uses braces means if we want to only define method structure , loop structure , if--else structure empty then we can use pass statement


for(i=1;i<=10;i++)   #C empty loop
{

}

for i in range(1,10):
   pass
             

WAP to display salary of employee where empid will be started from 1001 to 1020.
empid 1003,1005 and 1007 salary should not be displayed ,empid 1013 and 1015 ,2 days salary should be deduced ,if entered salary is above 20000 then calculation will be performed till 1017.
Salary is common for all employee.






Post a Comment

If you have any doubt in programming or join online classes then you can contact us by comment .

Previous Post Next Post