cars = ["ok", "ok", "ok", "faulty", "ok", "ok"]
for status in cars:
if status == "faulty":
print("Found faulty car, skipping...")
continue
print(f"This car is {status}.")
print("Shipping new car to customer!")
Output:
This car is ok.
Shipping new car to customer!
This car is ok.
Shipping new car to customer!
This car is ok.
Shipping new car to customer!
Found faulty car, skipping...
This car is ok.
Shipping new car to customer!
This car is ok.
Shipping new car to customer!