We have a list item_list,
item_list
item_list = [\"a\", \"b\", \"XYZ\", \"c\", \"d\", \"e\", \"f\", \"g\"]
We iterate over its items with a
Since nobody has mentioned a while loop, I will:
item_list = ["a", "b", "XYZ", "c", "d", "e", "f", "g"] i = 0 while i < len(item_list): item = item_list[i] if item == "XYZ": do_something() i += 3 else: do_something_else() i += 1