I have the following list of strings:
a = ['1234!zf', '5678!ras', 'abcd!ggt', 'defg!z', 'hijk!', 'lmnk!reom']
I want to replace the 4th character with another character (the character will always be the same in every string, I just don't know it, in this case it's '!'), for example '&'. How can I do that?
Resulting list of strings should look like this:
a = ['1234&zf', '5678&ras', 'abcd&ggt', 'defg&z', 'hijk&', 'lmnk&reom']
I know that strings in python are immutable and I honestly have no idea how to work with them. I tried all sorts of thins from foreach, using for with iterator, using .join(), using replace(), using list[4:], list[:4] and so many more and I just can't make this simple task work on python.
Note: Resulting list must be in list 'a'