This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
def word_to_dict(word): | |
"""This function converts a string to a dictionary: key = letter, | |
value = list of indexes where letter is found""" | |
word_dict = {} | |
for count,letter in enumerate(word): | |
if letter in word_dict: | |
word_dict[letter].append(count) | |
else: |