TypeError: unsupported operand type(s) for +: 'int' and 'str'
An operator was used between two incompatible types, such as adding a number to a string.
Seen on:
Python
Meaning
Python doesn’t convert types implicitly. Values read from input(), files, JSON or environment variables are strings even when they look like numbers.
Common causes
- input() / env var / CSV value used as a number
- None in arithmetic (NoneType)
- Mixing lists and numbers
⚡ Quick fix
- Convert explicitly: int(x), float(x), str(x)
- Use f-strings for text: f"{count} items"
- Check for None before arithmetic
Detailed fix by platform
Python
total = int(qty) * float(price)
How to diagnose
- Types — Which two types are named?
- Source — Where does each value come from?
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026