Python TypeError


Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 24, in
TypeError: unsupported operand type(s) for +: ‘list’ and ‘float’

Hello,
I have a basic problem for python.
Python gives warning to me when I write x2 on code,The warning finished when I write x1.
X1-X2 input is same data each one is x coordinate.
I need X2 data on this code how can I solve this problem ?

We can only guess if you don’t show the inputs, but the error is saying that x2 is a list. You need to reduce the list to a single item.

Uploading: image.png…
Could you please review this screen shot to solve this problem.


Could you please review this screen shot to solve this problem.

Hi @eness.gun

here you are trying to sum a list up with a float. Thus, the error occured by running. To resolve it, you need to use square brackets x2[0] to retrieve the first element from the list.

As I mentioned, you have a list. You need to reduce that list to a single item (not just a single item within a list) or add a loop in your code to execute the whole list.