BugHunt

TypeError: '>' not supported between instances of 'str' and 'int'

You compared text with a number. The value arrived as a string and was never converted.

PythonType errors

What it means

Python 3 refuses to order unrelated types rather than guessing. This is deliberate — Python 2 allowed it and produced meaningless results. Anything from input(), a form, a CSV, JSON or a query string arrives as text.

Common causes

1. input() always returns a string

Even when the user types digits, you get "42", not 42.

Breaks

age = input("Age: ")
if age > 18:
    print("adult")

Works

age = int(input("Age: "))
if age > 18:
    print("adult")

2. Values from a file or API

CSV columns and query parameters are text until you convert them.

Breaks

if row["score"] > 50:

Works

if int(row["score"]) > 50:

How to find it in your own code

Convert once, at the boundary where data enters your program, rather than scattering int() through your logic. When a value surprises you, print its type before its value.

Still not sure why yours breaks?

Paste it into the visualizer and watch it run line by line, with every variable at every step. Free, and it runs in your browser.

Other common errors