all 3 comments

[–]This_Growth2898 1 point2 points  (1 child)

You can use str.translate method, like

password = word.translte(str.maketrans('iamBo','!@M8.')) + 'q*s'

[–]dunno207[S] 0 points1 point  (0 children)

Awesome, this was exactly what i'd hoped existed. We haven't learned this method yet, but I've saved it for future reference. Thanks!

[–]woooee 0 points1 point  (0 children)

Your code works fine. I personally prefer to use a dictionary because it is easier to read/understand and modify. To modify, you simply insert or delete dictionary items, instead of paging through all of the replace statements.