Loops

Repeat work with for and while, and control it with break and continue.

A for loop goes through each item of a sequence. range() produces numbers: it stops before the end value.

Expected output
Round 1
Round 2
Round 3
Hello Asha
Hello Bala

while, break and continue

Expected output
15
1 2 4 5 

continue skips to the next round, and break leaves the loop. In a while loop, make sure something changes, or it will never stop.

โ† ConditionsLists and tuples โ†’