TryBugHunt
pythonType errorEasy

Number check says 5 is not a number

BugFind the bug and fix the code

What it should do

is_number(value) returns True for whole and decimal numbers, and False for anything else. Example: is_number(5) → True, is_number("5") → False.

What happens instead

is_number(5) returns False. So does is_number(2.5).

def is_number(value):
    return type(value) == "int" or type(value) == "float"

Test a custom input to verify an edge case (e.g. empty lists, negative numbers, duplicates).

⏱️0:00
Hints
🏆 0 hints = Flawless Solve
Think & Test Cooldown
2:00 remaining

Take a moment to read the bug symptom and trace the code with Run & Check before unlocking Hint 1.

Hint 2
Unlocks after Hint 1
Hint 3
Unlocks after Hint 2

This bug belongs to the type errors pattern

Strings that look like numbers, totals that refuse to add, comparisons between str and int.

What you'll practise

An easy Python debugging exercise about type errors: strings that look like numbers, totals that refuse to add, comparisons between str and int.

The checks your fix must pass

Signs of this kind of bug

Spoiler: why this bug happens(try it first; the hints get warmer one at a time)

What went wrong: type(5) is int, not the text "int". Comparing them is always False.

The fix: return isinstance(value, (int, float))

Remember: check types with isinstance().

The pattern behind it: type errors.

More type errors to practise

Related errors

Embed this challenge on your site

Paste this into any web page or blog post. Visitors fix the bug right there, in their browser.

<iframe src="https://trybughunt.com/embed/57f715f1-cdf5-4223-843b-89910c253281" title="Debugging challenge: Number check says 5 is not a number" 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/57f715f1-cdf5-4223-843b-89910c253281">TryBugHunt</a></p>