Here is actual code:
def replace_exception_chars(string):
exception_chars_dict = {'Old': 'New', 'old': 'new'}
exception_chars_keys = list(exception_chars_dict.keys())
for exception_char in exception_chars_keys:
if exception_char in string:
string.replace(exception_char, exception_chars_dict[exception_char])
return string
print(replace_exception_chars('Old, not old'))
If I'm trying to run it I'm getting unchanged source string in OUTPUT. Please have a look:
Why its happening that way?
UPDATE desired output:
New, not new