Learning Loop Control Statements in Python

Day 17/120 of my Python Full Stack Journey Topic: Loop Control Statements – break, continue, pass Today I learned how to control the flow of loops using special keywords. #Python #BreakContinuePass #ProgrammingBasics #DailyLearning #FullStackDeveloperJourney #KeepGoing Pooja Chinthakayala mam Saketh Kallepu sir Uppugundla Sairam sir Codegnan #break #break statement is used to terminate the entire loop a=10 while a>1:   print(a)   a=a-1 a=10 while a>1:   a=a-1   print(a)     a=10 while a>1:   print(a)   a=a-1   if a==4:     break for i in range(10):   print(i) for i in range(10):   if i==8:     break   print(i) a="python" for i in a:   if i=="h":     break   print(i) #continue #the continue statement is used to skip the current iteration and rest of the code will continue a=20 while a>2:   print(a)   a=a-1 a=20 while a>2:   a=a-1   print(a) a=20 while a>2:   print(a)   a=a-1   if a==12:     continue a=20 while a>2:   a=a-1   if a==12:     continue   print(a) for i in range(15):   if i==9:     continue   print(i) a="code" for i in a:   if i=="o":     continue   print(i) #pass #pass statement is a null statement it does nothing but syntactically we need. a=30 while a>5:   print(a)   a=a-1   if a==15:     pass for i in range(14):   if i==10:     pass   print(i)

To view or add a comment, sign in

Explore content categories