I have a list whose contents are:
x = ['A', 2, 'B', 2, 'C', 2, 'D', 2, 'a', 4, 'b', 2, 'c', 1, 'd', 2]
I want the output as:
A2B2C2D2a4b2c1d2
I tried with the line:
print(''.join(str(x)))
But it gives me an error that says:
print(''.join(str(x)))
TypeError: 'str' object is not callable`
Guess it's occurring because of those integers along with the strings.
How to tackle this to get the desired output as mentioned above?
print(''.join(map(str, x)))