Spot the problem in this AI code

Python. The task: "Write a function that splits a mailing list into batches of 100 for the email API." Read the code, then pick what goes wrong.

batches.py
def make_batches(emails, size=100):
    """Split a mailing list into batches the email API accepts."""
    batches = []
    for i in range(len(emails) // size):
        batches.append(emails[i * size:(i + 1) * size])
    return batches

We pass a list of 250 emails. What goes wrong?

  1. Each batch after the 1st skips an email at the boundary
  2. The last 50 emails are dropped, because // rounds the batch count down
  3. Each batch has 101 emails, because the slice end is included
  4. It crashes with an IndexError on the last, shorter batch

Show the answerHide the answer

Answer B: The last 50 emails are dropped, because // rounds the batch count down

With 250 emails it returned batches: 2 sizes: [100, 100] and sent: 200 of 250, so user250@example.com never got the message. 250 // 100 is 2, so the loop never makes a batch for the 50 left over. Rounding the count up with (len(emails) + size - 1) // size gave batches: 3 sizes: [100, 100, 50] and sent: 250 of 250.

The fix: batches.py
def make_batches(emails, size=100):
    """Split a mailing list into batches the email API accepts."""
    batches = []
    for i in range((len(emails) + size - 1) // size):
        batches.append(emails[i * size:(i + 1) * size])
    return batches

Explain it at your depth

The code is already in the box below. Pick a level and press Explain it, and Vibe explains it in plain English. Free, no account.

batches.py

Up to 1,500 characters (about 60 lines). Your code is sent to Unvibe and Anthropic to write the explanation. Don't paste keys or passwords. Common key formats are refused.

Vibe7 lines selected

Press Explain it for the sample, or paste your own code first.

Explain code beside your editor

When your AI tool writes code, select the code in any app and press the shortcut. On a Mac that's Control+U, not Command+U (⌘U only works in Cursor and VS Code with the editor bridge). On Windows it's Ctrl+Alt+U. Vibe explains it beside your editor, you can ask it why, and Test me checks that you followed. Unvibe is a free app for Mac and Windows.

Install on Mac

curl -fsSL https://unvibe.site/install.sh | bash

Paste into Terminal. Unvibe isn't notarized by Apple yet, so this is the smooth path.

No install warning? Use Unvibe in your browser

Opening the .dmg the first time
  1. Open the .dmg and drag Unvibe to Applications.
  2. Open it once; macOS says it can't verify it. Click Done, not the blue Move to Trash.
    macOS dialog: “Unvibe” Not Opened, with a blue Move to Trash button on top and Done under it
    Real screen, macOS 26. On macOS 15 the two buttons sit side by side.
  3. System Settings › Privacy & Security, scroll down to Security, then press Open Anyway. Confirm, then enter your Mac password. The button shows for about an hour after you try to open Unvibe.
    macOS Privacy & Security, Security section: Unvibe was blocked to protect your Mac, with the Open Anyway button
    Real screen, macOS 15

The Terminal line checks the download against the published SHA-256 and Unvibe's self-signed signature before it installs anything. More help with the first open