continue pythin code example

Example 1: continue py

# Program to show the use of continue statement inside loops

for val in "string":
    if val == "i":
        continue
    print(val)

print("The end")
# Output:
# s
# t
# r
# n
# g

Example 2: continue statement python

import numpy as np
values=np.arange(0,10)
for value in values:
  if value==3:
    continue
  elif value==8:
    print('Eight value')
  elif value==9:
    break

Example 3: continue in python

# Example of continue loop:

for number is range (0,5):
    # If the number is 4, skip the rest of the loop and continue from the top.
    if number == 4:
      continue
    
    print(f"Number is: {number}")