A=s.append(s[i]+A+B)
A=s.append(s[i]+A+B) TypeError: unsupported operand type(s) for +: 'long' and 'str'
What does this error mean ? A and B are strings and s is a list
A=s.append(s[i]+A+B)
A=s.append(s[i]+A+B) TypeError: unsupported operand type(s) for +: 'long' and 'str'
What does this error mean ? A and B are strings and s is a list
s may be a list, but the element - s[i] - is not - it's a long, as indicated by the error.
In addition, append() operates on the list directly - it returns None, so you're actually setting A to be None - probably not what you wanted!
There are two things you can do to help avoid this type of error in the future.
Don't use one-letter variable names. Use descriptive, one to three-word length names that describe what the variable has in it (and/or what it's supposed to be used for).
When you do have a problem, try putting it in a try/except block where you put the error name after except and print out the offending variables:
try:
s.append(s[i]+A+B)
except TypeError:
print "Failed to add", s[i], ",", A, ",", "and", B
raise
Don't forget the raise at the end there - that way you don't just ignore the issue and start getting really strange errors.