Not sure why you want to do this (it's schoolwork)? Anyway, this is my version:
word = input('input word you want to change letters in: ') chars = tuple(word) change_this = input('Enter the letters you want to change: ') replace_with = input('Enter the letters to replace with: ') if len(change_this) != len(replace_with): raise RuntimeError( "Letters to replace must be equals in number to letters you want " + "to change" ) change_chars = tuple(change_this) replace_chars = tuple(replace_with) new_chars = [] for ch in chars: try: i = change_chars.index(ch) except ValueError: new_chars.append(ch) else: new_chars.append(replace_chars[i]) -- https://mail.python.org/mailman/listinfo/python-list