A library to pick hangman words.
Project description
The Hangman Wordlist
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file the_hangman_wordlist-0.8.tar.gz.
File metadata
- Download URL: the_hangman_wordlist-0.8.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c15d99e11aeecaf9cceefcd9ce23e822a58344f08195e2c6c5fe99a94fc0067b
|
|
| MD5 |
8c98fdaf4456fb90efcbbbb11a9cb863
|
|
| BLAKE2b-256 |
3c911a24946e95bff27620ff820e6622ec83d71a87bb953be29fa6b98b34c71d
|
File details
Details for the file the_hangman_wordlist-0.8-py3-none-any.whl.
File metadata
- Download URL: the_hangman_wordlist-0.8-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3017f9fc88fad9b719e73bfcbaf3fbf58990b08116ef60daa539d6fd66728e9
|
|
| MD5 |
4b3e61b7ad1d5c98a3162e57cfef59d4
|
|
| BLAKE2b-256 |
c5aa61f4acd595ba2cfa17da729109469bae82972fdc8289a368ae618d11b0fc
|