for future reference, you can use enumerate() to return indices and values in a iterable.    for z, part in enumerate(problem_url_parts):