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:
https://replit.com/@shwetaantil97/conditional-expressions-with-loops#main.py
Comments
Thankyou CODE INFINITY 👍💯