Time: 0:00
This is a type errors bug
Totals that concatenate, sorts that put 10 before 9, comparisons that refuse to run.
What went wrong: split() returns text, like "4". sum() cannot add text to numbers.
The fix: return sum(int(v) for v in values)
Remember: split() always gives text. Convert the pieces before doing maths.
The pattern behind it: type errors.
Paste this into any web page or blog post. Visitors fix the bug right there, in their browser.
<iframe src="https://trybughunt.com/embed/3505b842-5412-49a2-8d97-41090ca63935" title="Debugging challenge: Adding up "4,5,6" crashes" width="100%" height="580" loading="lazy" style="border:1px solid #d4d4d8;border-radius:12px;max-width:760px"></iframe>
<p style="font-size:14px">Debugging challenge from <a href="https://trybughunt.com/challenges/3505b842-5412-49a2-8d97-41090ca63935">BugHunt</a></p>