Run
# Given string x = "hello world" # Define a mapping table table = x.maketrans('lo', 'pm') # Translate given string x_translated = x.translate(table) print(f"Original : \"{x}\"") print(f"Translated : \"{x_translated}\"")
Output