The break statement is used to "break" the loop. It means that when a break statement is executed, it skips the execution below it in the loop and exits the loop.
Ex:
for letter in 'HelloWorld':
if letter == 'W':
break
print 'Character is:', letter
Output for this code will be:
Character is: H
Character is: e
Character is: l
Character is: l
Character is: o
The continue statement is used to continue the loop by skipping the execution of code below it i.e., when a continue statement is executed, it skips executing the code below it but goes back to the loop and continues with the next cycle.
Ex:
for letter in 'Hello':
if letter == 'H':
continue
print 'Character is: ', letter
Output for this code will be:
Character is: e
Character is: l
Character is: l
Character is: o