Unsupported Operand Type(S) for +: 'Int' and 'Str' - ITCodar
TypeError: unsupported operand type(s) for -: 'str' and 'int' (Python) n is string. So you need to change it to int: n = int(n) If you input [5,6,2,7] on line 37, python interpret it as string like "[5,6,2,7]". So, you need to convert string to list. arr = eval(arr)