DAY 8(CODE INFINITY)

Today's we continue our same topic of conditional expressions . We use if else with both for loops , while loops and other statements like break statement, continue statement ,pass statement etc. Let's get started.....

name='Shweta'

for i in name:

print(i)

if (i=='w'):

   break

else:

      print("Done with the loop")

Another example with while loop:

n=0

while i in (n>0):

print(i)

i=i+1

break statement : This statement instructs the program to exit the loop.

continue statement: This statement instructs the program to 'skip the iteration' .

pass statement: This is a null statement it instructs to 'Do nothing' .

Screenshot of the repel given below:

Link of the repel:

https://replit.com/@shwetaantil97/conditional-expressions-with-loops#main.py


 

Comments

Lusia said…
It is very useful for me also bcoz I didn't understand the concept of loop... Which today and yesterday blog teaches me very well...
Thankyou CODE INFINITY 👍💯

Popular posts from this blog