Skip to content

Instantly share code, notes, and snippets.

@bdrum
Last active August 15, 2022 04:23
Show Gist options
  • Save bdrum/2869579b1388038f5415d52d009506c1 to your computer and use it in GitHub Desktop.
Save bdrum/2869579b1388038f5415d52d009506c1 to your computer and use it in GitHub Desktop.
GuessTheWord game

Here is the simple implementation of GuessTheWord game on python

from collections import Counter

def GuessTheWord(word: str):

    letters = Counter(word.lower()).items()
    letters = sorted(letters)
    if not letters[0][0].strip():
        letters = letters[1:]
    return letters
GuessTheWord("Projection")
[('c', 1),
 ('e', 1),
 ('i', 1),
 ('j', 1),
 ('n', 1),
 ('o', 2),
 ('p', 1),
 ('r', 1),
 ('t', 1)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment