sir how to solve this error
Traceback (most recent call last):
File "main.py", line 11, in <module>
print(a.translate(table))
AttributeError: 'list' object has no attribute 'translate'
s = ["Hello","Where","Delhi"]
a = "HellHour"
print("Original string:", a)
table = a.maketrans(s[0],s[1],s[2])
# translate string
print("Translated string:", a.translate(table))
Python Output:
Original string: HellHour
Translated string: WWeur
>>>
Comments
Leave a comment