Skip to main content

A library to pick hangman words.

Project description

Screenshot of code PyPI version

[!NOTE] A simple Python library with a wordlist for use with hangman featuring easy, medium and hard words!

Usage

First install the package:

$ pip install the-hangman-wordlist

or

$ pip3 install the-hangman-wordlist

Then you could use it like in this example code:

from the_hangman_wordlist import HangmanWordlist

if __name__ == "__main__":
    wordlist = HangmanWordlist()
    difficulty = input("What difficulty do you want? (easy/medium/hard): ")
    word, version = wordlist.pull_word(difficulty)
    print(f"\nThe {difficulty} word is: '{word}'")
    print(f"Wordlist v{version}")
    input("\nPress Enter to exit...")

Functions

def __init__():
    # Loads when HangmanWordlist is imported, sets the variables and loads the wordlist with the load_wordlist() function.

def fetch_online_wordlist():
    # Fetches the wordlist online and returns it as json.

def load_wordlist():
    # Checks if the user has a copy of the wordlist.json and if it's up to date and then downloads it if necessary with the save_wordlist() function.

def save_wordlist(wordlist):
    # Saves the passed wordlist to wordlist.json

def pull_word(difficulty):
    # Checks if the difficulty passed is a correct option if not it chooses a random difficulty and then it returns a random word from the chosen difficulty and the wordlist version.

Only the pull_world() function was made to be called by the user the different functions should be called automatically when the script is initialized.

Credits

  • Jurriaaaantje (Wordlist words and update wordlist functionality)
  • TheBiemGamer (Version check, json functionality and library)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

the_hangman_wordlist-0.8.1.tar.gz (273.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

the_hangman_wordlist-0.8.1-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file the_hangman_wordlist-0.8.1.tar.gz.

File metadata

  • Download URL: the_hangman_wordlist-0.8.1.tar.gz
  • Upload date:
  • Size: 273.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for the_hangman_wordlist-0.8.1.tar.gz
Algorithm Hash digest
SHA256 52c46608f381c78aa2ec6de3751e13580b208257abca384b01b8b7a1b16b500c
MD5 868dd06a02fab3b187b4b76f4e6e1a52
BLAKE2b-256 4b477dd6856ec55a719bc54772f6b4a06f8cb24f019f200b9f1c7eee2b60e7b2

See more details on using hashes here.

File details

Details for the file the_hangman_wordlist-0.8.1-py3-none-any.whl.

File metadata

File hashes

Hashes for the_hangman_wordlist-0.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d4d6535d80193accec534c380544b08d661cc584ad4205c4347e7dec29184bf5
MD5 445802493ff4ea925807ed6fc6ffc47b
BLAKE2b-256 4417fa9d06df3156602b4b7d1f9fb1bf884a9edfb3d4f2c90376df55de5a86e4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page