This is perhaps a result of bad design, but here it goes. I wasn't quite sure how to explain this problem.
So I have code that iterates over a list of words. (This list does not change.) The code then parses and combines certain words together, depending on a set of criteria, storing them in a new list. The master loop, which is taking each word one at a time, would then need to skip what the code decided was a fit. So for example:
Master loop's list of words:
ListA = [apple, banana, penguin]
Within the master loop, let's say my code decided apple and bananna belong together, so
ListB = [apple banana, penguin]
Now I would like to have Master Loop skip over bananna, it doesn't need to run the check over whether to see if banana pairs with something else. So I would use a continue statement. Here is the problem. I don't know how many words will end up paired. So I could end up needing one continue, or three continues. The only way I can think of to run continue as many times as needed would be to use a loop...but that creates a problem since continue would affect the loop it is within.
Is there a way for me to make the master loop continue as many times as needed? Perhaps I am missing something simple. Thanks for your help.
EDIT
word_list = ["apple", "banana", "penguin"] #word_list will be arbitrary in practice
phrase_length = 0 #phrase_length is the amount of times I would like to skip
for k, word in enumerate(word_list):
#I would like to have the continues run here, before any of the below code
#the code down here decides what to pair in a forward fashion
#so it starts from apple and looks ahead to see if something fits with it
#continues in this manner till it comes up with the longest possible pairing
#phrase_length is then set equal to the amount of words used make the pairing
It would waste a considerable amount of computing time, if it had to execute the code for banana as well, checking forward from there as well. Which is why I would want to skip over the banana check.