candidates = ['abacus', 'ball', 'car']
for candidate in candidates:
if dict[candidate] == "true":
"""next"""
else:
continue
"""do something"""
What I'm trying to do here is check for the presence of a term in a dictionary, and if it exists, move the control flow to the next item in the list candidates. I'm having trouble using next(). How do I go about this?
next? what do you want to happen if it exists? Going to the next candidate is whatcontinuewould do.continuewould already move to the next element in an iteration, wouldn't it? what are you trying to do differently between the if and else clauses?continue?