Answer to Question #195391 in Python for Chavali Anand Babu

Question #195391

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'
1
Expert's answer
2021-05-20T00:29:22-0400


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

>>> 


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS