TypeError operand Python Origin: Application & API Last updated 15 Oct 2026

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.

Exact message you may see unsupported operand type(s)unsupported operand type(s) for +
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

  1. Convert explicitly: int(x), float(x), str(x)
  2. Use f-strings for text: f"{count} items"
  3. Check for None before arithmetic

Detailed fix by platform

Python

  1. total = int(qty) * float(price)

How to diagnose

  1. Types — Which two types are named?
  2. Source — Where does each value come from?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Application & API. Errors that are often confused with or caused by this one (click to open):

AttributeError — AttributeError: 'X' object has no attribute 'y' (Python)AttributeErrorCannot convert value of type — Swift: Cannot convert value of type 'X' to expected argument type 'Y' (iOS)Cannot convert value …ClassCastException — java.lang.ClassCastException: class A cannot be cast to class B (Java)ClassCastExceptionE0308 — Rust: error[E0308]: mismatched types — expected `X`, found `Y` (Rust)E0308ERR_INVALID_ARG_TYPE — TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined (Node.js)ERR_INVALID_ARG_TYPETS2322 — TS2322: Type 'X' is not assignable to type 'Y' (TypeScript)TS2322TS2564 — TS2564: Property 'x' has no initializer and is not definitely assigned in the constructor (TypeScript)TS2564TypeError concat — TypeError: can only concatenate str (not "int") to str (Python)TypeError concatTypeError…

Explore the map of this error Full error map →

🧠 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.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.