Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

unsupported operand type python

""" You are attempting to peform an arithmetic operation (i.e +, -, /, //, %) on 2 objects
that do not support that operand. """

# Example:

x = [1, 2, 3]
y = 4

x = x + y

""" This results in an error of unsupported operand of + on list and string since you
can not add a string to a list """

# You would instead need to do:

x.append(y)
print(x) # [1, 2, 3, 4]

 
PREVIOUS NEXT
Tagged: #unsupported #operand #type #python
ADD COMMENT
Topic
Name
1+6 =