TypeError: can't multiply sequence by non-int of type 'float' (tested fix)

TypeError: can't multiply sequence by non-int of type 'float' means one side of * is a string, list or tuple. Usually it's a number that was never converted from text. We reproduced it in Python 3.13, including a variant that gives a wrong answer instead of an error.

1. * on a str, list or tuple means repeat

For sequences, * repeats the sequence, so the other operand must be an int. Any other type raises this error, and the message names that type. The most common cause is a number that is still a string. Watch the first line: multiplying that string by an int raises nothing:

price = "2.50"                     # e.g. from input() or a CSV field
for expr in ['price * 3', 'price * 1.1', '[1, 2] * 1.5', '"ab" * "2"', '(1,) * [2]', '[1, 2] * [3, 4]']:
    try:
        r = eval(expr); print(f"{expr:16} OK -> {r!r}")
    except TypeError as e:
        print(f"{expr:16} TypeError: {e}")

Output:

price * 3        OK -> '2.502.502.50'
price * 1.1      TypeError: can't multiply sequence by non-int of type 'float'
[1, 2] * 1.5     TypeError: can't multiply sequence by non-int of type 'float'
"ab" * "2"       TypeError: can't multiply sequence by non-int of type 'str'
(1,) * [2]       TypeError: can't multiply sequence by non-int of type 'list'
[1, 2] * [3, 4]  TypeError: can't multiply sequence by non-int of type 'list'

So price * 3 silently gives '2.502.502.50', and the bug only surfaces later, when you multiply by a float such as a tax rate.

2. The fix: convert, or work per item

price = "2.50"
print(float(price) * 1.1)                    # convert the string first
print(round(float(price) * 3, 2))
nums = [1, 2]
print([x * 1.5 for x in nums])               # scale each item
print([a * b for a, b in zip([1, 2], [3, 4])])  # element-wise product
print("-" * int(2.0))                        # repeat needs an int

Output:

2.75
7.5
[1.5, 3.0]
[3, 8]
--

Convert strings with float() or int() as soon as you read them. To scale or multiply lists of numbers, use a comprehension, or zip() for element-wise products. NumPy arrays do element-wise math directly, but we didn't test NumPy here. If you really meant repetition, pass an int. The float-instead-of-int case is covered in 'float' object cannot be interpreted as an integer.

Frequently asked questions

How do I fix can't multiply sequence by non-int of type 'float'?

Convert the string to a number first: float(price) * 1.1. For a list, multiply each item: [x * 1.5 for x in nums].

Why does "2.50" * 3 not raise an error?

A str times an int repeats the string, giving '2.502.502.50'. Convert with float() first.

How do I multiply two lists element-wise?

Use zip: [a * b for a, b in zip(xs, ys)]. list * list raises this TypeError.

Written with AI assistance. Measured on 2026-10-22 on Debian with Python 3.13.5: * between a numeric string, list or tuple and an int, float, str or list, and the float(), comprehension and zip fixes. Every block was run verbatim and its output pasted unedited. NumPy was not tested. PlainHeaders is our extension; Python is free.