Skip to content
Back to skills

Use Enumerate And Zip

ASecurity

When a loop needs an index or walks two sequences together, use enumerate or zip

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 17, 2026
ai-agents

Security analysis

A100/100

Scanned October 17, 2026

npx -y skills add samugit83/cortex --skill use-enumerate-and-zip --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Use Enumerate And Zip?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Use Enumerate And Zip
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/samugit83-use-enumerate-and-zip/badge)](https://www.skillsdirectory.com/skills/samugit83-use-enumerate-and-zip)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: use-enumerate-and-zip
description: When a loop needs an index or walks two sequences together, use enumerate or zip
---

# enumerate and zip

`range(len(xs))` exists to be replaced.

- Need the position: `for i, x in enumerate(xs)`, with `start=1` when the
  position is shown to a person.
- Walking two sequences: `for a, b in zip(xs, ys)`, and `strict=True` when they
  are meant to be the same length, so a mismatch is an error rather than a
  silently short result.
- Need both: `for i, (a, b) in enumerate(zip(xs, ys))`.

Indexing into a sequence inside a loop that already yields its items is almost
always a leftover from an earlier version of the code.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.