Prompt
Write a Python function `slugify(text)` that turns a string into a URL slug: lowercase, with
every run of non-alphanumeric characters replaced by a single hyphen, and no leading or trailing
hyphens. Examples: `"Hello, World!"` -> `"hello-world"`, `" Foo Bar "` -> `"foo-bar"`,
`"C++ Guide"` -> `"c-guide"`. Empty input returns `""`.
Put it in a single Python code block. It will be imported as `from solution import slugify`.when to use it
Community prompt sourced from the open-source GitHub repo Green-PT/honey-for-devs (MIT). A "Prompt" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.
tags
codingcommunitydeveloper
source
Green-PT/honey-for-devs · MIT
more in Coding
Coding✓ tested
Senior code review (strict mode)
senior staff engineer running a merciless but fair review
Coding✓ tested
Debug by hypothesis, not by guessing
debugging partner who forms theories before touching code
Coding✓ tested
Generate tests from described behavior
test engineer who writes tests that would actually catch regressions