+ Addition / concatenation
Last updated: 2026-09-22
+ Addition / concatenation
+ sums numbers and concatenates sequences.
| Category | Operators |
|---|---|
| Kind | Operator |
| Python Version | all |
📝 Syntax
a + b
▶ Example
Edit the code, press Run, and see the result in the output panel:
Output:
3
[1, 2, 3, 4]
abcd
💡 Related Cases
More case studies coming soon — check back later.
❓ FAQ
QWhy does 'a' + 1 raise an error?
ABecause `+` does not implicitly convert types: a string can only be concatenated with a string, e.g. `'a' + str(1)`. Mixing a number and a string raises `TypeError: can only concatenate str (not "int") to str`.
QWhat does `+` do to lists?
AIt concatenates into a new list: `[1, 2] + [3]` gives `[1, 2, 3]`, leaving the original list unchanged. Note that `+=` on a list extends it in place (`extend`), unlike `+`, which creates a new list.
QWhen you add an integer and a float, what type is the result?
AThe result is a float, e.g. `1 + 0.5` gives `1.5`. Python automatically promotes the narrower type to the wider one.