Skip to content

Instantly share code, notes, and snippets.

@syappp
syappp / hangman.py
Created June 20, 2021 00:01
Hangman Game
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: